mt_rng: made use of std::mersenne_twister_engine::discard

The issue described seemed to be with the boost version, so it should be fixed (hopefully) with the std version
This commit is contained in:
Charles Dang 2017-04-20 08:13:47 +11:00
parent e91aeb0860
commit 42b309165a
2 changed files with 1 additions and 14 deletions

View file

@ -80,7 +80,7 @@ void mt_rng::seed_random(const uint32_t seed, const unsigned int call_count)
{
random_seed_ = seed;
mt_.seed(random_seed_);
discard(call_count); //mt_.discard(call_count);
mt_.discard(call_count);
DBG_RND << "Seeded random with " << std::hex << random_seed_ << std::dec << " with "
<< random_calls_ << " calls." << std::endl;
}
@ -105,12 +105,5 @@ std::string mt_rng::get_random_seed_str() const {
return stream.str();
}
void mt_rng::discard(const unsigned int call_count)
{
for(unsigned int i = 0; i < call_count; ++i) {
get_next_random();
}
}
} // ends rand_rng namespace

View file

@ -70,12 +70,6 @@ private:
/** Number of time a random number is generated. */
unsigned int random_calls_;
/** On my local version of boost::random, I can use mt_.discard to discard a number of rng results.
In older versions this seems to be unavailable. I'm implementing as a private method of mt_rng,
following description here: http://www.boost.org/doc/libs/1_51_0/doc/html/boost/random/mersenne_twister_engine.html#id1408119-bb
*/
void discard(const unsigned int call_count);
/**
* Seeds the random pool. This is the old version, I would like to mark this private.
*