|
Boost Users : |
From: Graham Reitz (graham.cpp_at_[hidden])
Date: 2007-10-23 13:00:10
I am little confused on how to see a random generator.
What am I missing?
// Grab the seed
HighResTimer::Time time_secs = high_res_timer.getTime();
// Go ahead and truncate, it's just a seed
boost::int32_t time = static_cast<boost::int32_t>(time_secs * 100000);
// produces randomness out of thin air
// see pseudo-random number generators
boost::mt19937 rng;
rng.seed(); // How do you seed this with the time?
// distribution that maps to 0..1
// see random number distributions
boost::uniform_real<> zero_to_one(0,1);
// glues randomness with mapping
boost::variate_generator<boost::mt19937&, boost::uniform_real<> >
be_random zero_to_one);
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net