Skip to content

Commit

Permalink
Refactors master seed mechanism in System
Browse files Browse the repository at this point in the history
Renames the seed random number gen
  • Loading branch information
fzenke committed May 10, 2018
1 parent 82b0f11 commit 9ca0409
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/auryn/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ void System::init() {

// init random number generator
// gen = boost::mt19937();
dist = new boost::random::uniform_int_distribution<> ();
die = new boost::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > ( gen, *dist );
seed_dist = new boost::random::uniform_int_distribution<> ();
seed_die = new boost::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > ( seed_gen, *seed_dist );
unsigned int hardcoded_seed = 3521;
set_master_seed(hardcoded_seed);

Expand Down Expand Up @@ -203,8 +203,8 @@ void System::free()
delete syncbuffer;
#endif // AURYN_CODE_USE_MPI

delete dist;
delete die;
delete seed_dist;
delete seed_die;
}

void System::step()
Expand Down Expand Up @@ -1006,12 +1006,12 @@ void System::set_master_seed( unsigned int seed )
oss << "Seeding this rank with master seed " << rank_master_seed;
auryn::logger->msg(oss.str(),INFO);

gen.seed(rank_master_seed);
seed_gen.seed(rank_master_seed);
}

unsigned int System::get_seed()
{
return (*die)();
return (*seed_die)();
}

unsigned int System::get_synced_seed()
Expand Down
6 changes: 3 additions & 3 deletions src/auryn/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ namespace auryn {

string outputdir;

boost::mt19937 gen;
boost::random::uniform_int_distribution<> * dist;
boost::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > * die;
boost::mt19937 seed_gen;
boost::random::uniform_int_distribution<> * seed_dist;
boost::variate_generator<boost::mt19937&, boost::random::uniform_int_distribution<> > * seed_die;

double simulation_time_realtime_ratio;

Expand Down

0 comments on commit 9ca0409

Please sign in to comment.