Commit 7d11dab3 authored by Robin Eschbach's avatar Robin Eschbach
Browse files

[FIX #596] switch to c++ random generator

parent 40942e0d
......@@ -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;
......
......@@ -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 * noiseRange ) );
noise[ x ][ y ] = noiseBase + ( -noiseRange + unif( re ) );
// delta1[ x ][ y ] = 0.0;
// delta2[ x ][ y ] = 0.0;
}
......
......@@ -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 )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment