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_)
83 : generator_(seed), uniDist_(0, 1), normalDist_(0, 1), uni_(generator_, uniDist_), 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);