39 #include <boost/random/lagged_fibonacci.hpp> 40 #include <boost/random/uniform_int.hpp> 41 #include <boost/thread/mutex.hpp> 42 #include <boost/date_time/posix_time/posix_time.hpp> 43 #include <boost/math/constants/constants.hpp> 44 #include <boost/scoped_ptr.hpp> 51 boost::scoped_ptr<int> mem(
new int());
53 (boost::posix_time::microsec_clock::universal_time() - boost::posix_time::ptime(boost::date_time::min_date_time))
54 .total_microseconds() +
55 (
unsigned long long)(mem.get()));
64 static boost::mutex rngMutex;
65 boost::mutex::scoped_lock slock(rngMutex);
66 static boost::lagged_fibonacci607 sGen(
firstSeed());
67 static boost::uniform_int<> sDist(1, 1000000000);
68 static boost::variate_generator<boost::lagged_fibonacci607&, boost::uniform_int<> > s(sGen, sDist);
69 boost::uint32_t v = s();
77 , uni_(generator_, uniDist_)
78 , normal_(generator_, normalDist_)
94 double r1 = sqrt(1.0 - x0), r2 = sqrt(x0);
95 double t1 = 2.0 * boost::math::constants::pi<double>() *
uni_(),
96 t2 = 2.0 * boost::math::constants::pi<double>() *
uni_();
97 double c1 = cos(t1), s1 = sin(t1);
98 double c2 = cos(t2), s2 = sin(t2);
boost::mt19937 generator_
void quaternion(double value[4])
Uniform random unit quaternion sampling. The computed value has the order (x,y,z,w) ...
boost::uint32_t getFirstSeed()
Allow the randomly generated seed to be saved so that experiments / benchmarks can be recreated in th...
boost::uniform_real uniDist_
static boost::uint32_t firstSeed(void)
Compute the first seed to be used; this function should be called only once.
boost::variate_generator< boost::mt19937 &, boost::normal_distribution<> > normal_
static boost::uint32_t nextSeed(void)
boost::normal_distribution normalDist_
boost::variate_generator< boost::mt19937 &, boost::uniform_real<> > uni_
RandomNumberGenerator(void)
Constructor. Always sets a "random" random seed.
static boost::uint32_t first_seed_