Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
7d11dab3
Commit
7d11dab3
authored
Aug 25, 2022
by
Robin Eschbach
Browse files
[FIX
#596
] switch to c++ random generator
parent
40942e0d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
12 deletions
+16
-12
src/modules/hierarchicalClustering/hierchClustDisplay/WHtreeProcesser.cpp
...archicalClustering/hierchClustDisplay/WHtreeProcesser.cpp
+8
-3
src/modules/imageSpaceTensorLIC/WMImageSpaceTensorLIC.cpp
src/modules/imageSpaceTensorLIC/WMImageSpaceTensorLIC.cpp
+6
-2
src/modules/modules-others.toolbox
src/modules/modules-others.toolbox
+2
-7
No files found.
src/modules/hierarchicalClustering/hierchClustDisplay/WHtreeProcesser.cpp
View file @
7d11dab3
...
...
@@ -46,11 +46,12 @@
//
//---------------------------------------------------------------------------
#include <
vector
>
#include <
map
>
#include <list>
#include <random>
#include <string>
#include <utility>
#include <
map
>
#include <
vector
>
#include "core/common/WStringUtils.h"
...
...
@@ -247,9 +248,13 @@ std::pair< size_t, size_t > WHtreeProcesser::pruneRandom( const size_t numberPru
}
size_t
prunedLeaves
(
0
);
std
::
uniform_int_distribution
<
size_t
>
unif
(
0
,
prunedIDs
.
size
()
);
std
::
default_random_engine
re
;
re
.
seed
(
seed
);
while
(
prunedLeaves
<
numberPruned
)
{
size_t
prunedPosition
=
(
rand_r
(
&
seed
)
%
prunedIDs
.
size
()
);
size_t
prunedPosition
=
unif
(
re
);
if
(
m_tree
.
fetchLeaf
(
prunedIDs
[
prunedPosition
]
)
->
isFlagged
()
)
{
continue
;
...
...
src/modules/imageSpaceTensorLIC/WMImageSpaceTensorLIC.cpp
View file @
7d11dab3
...
...
@@ -25,6 +25,7 @@
#include <cmath>
#include <cstdlib>
#include <memory>
#include <random>
#include <string>
#include <vector>
...
...
@@ -112,14 +113,17 @@ void genReactionDiffusion( unsigned char* target,
/////////////////////////////////////////////////////////////////////////////////////////////
// init grids
srand48
(
time
(
0
)
);
std
::
uniform_real_distribution
<
float
>
unif
(
0.0
,
2.0
*
noiseRange
);
std
::
default_random_engine
re
;
re
.
seed
(
time
(
0
)
);
for
(
unsigned
int
y
=
0
;
y
<
tileHeight
;
y
++
)
{
for
(
unsigned
int
x
=
0
;
x
<
tileWidth
;
x
++
)
{
// grid1[ x ][ y ] = grid1Base;
// grid2[ x ][ y ] = grid2Base;
noise
[
x
][
y
]
=
noiseBase
+
(
-
noiseRange
+
(
drand48
()
*
2.0
*
noiseRang
e
)
);
noise
[
x
][
y
]
=
noiseBase
+
(
-
noiseRange
+
unif
(
r
e
)
);
// delta1[ x ][ y ] = 0.0;
// delta2[ x ][ y ] = 0.0;
}
...
...
src/modules/modules-others.toolbox
View file @
7d11dab3
...
...
@@ -26,16 +26,11 @@ ADD_MODULE( fiberSelection )
ADD_MODULE( fibersToPoints )
ADD_MODULE( fiberTransform )
ADD_MODULE( functionalMRIViewer )
# This does not compile with windows build due to special random functions.
IF( NOT OW_FIX_WINDOWS_RANDOM_ERROR )
ADD_MODULE( hierarchicalClustering )
ENDIF()
ADD_MODULE( hierarchicalClustering )
ADD_MODULE( histogramView )
ADD_MODULE( imageExtractor )
# This does not compile with windows build due to special random functions.
IF( NOT OW_FIX_WINDOWS_RANDOM_ERROR )
ADD_MODULE( imageSpaceTensorLIC )
ENDIF()
ADD_MODULE( imageSpaceTensorLIC )
ADD_MODULE( mergeComponentsToVector )
ADD_MODULE( mergePoints )
ADD_MODULE( meshToPoints )
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment