25 #include <boost/date_time/posix_time/posix_time.hpp>
26 #include <boost/thread/locks.hpp>
27 #include <boost/thread/mutex.hpp>
34 boost::mutex rng_generator::m_mutex;
37 rng_uint32 rng_generator::m_seeder(boost::uint32_t((boost::posix_time::microsec_clock::local_time() -
38 boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_microseconds()));
49 boost::lock_guard<boost::mutex> lock(m_mutex);
57 boost::lock_guard<boost::mutex> lock(m_mutex);
58 return Rng(m_seeder());
61 template __PAGMO_VISIBLE
rng_double rng_generator::get<rng_double>();
62 template __PAGMO_VISIBLE
rng_uint32 rng_generator::get<rng_uint32>();
This rng returns an unsigned integer in the [0,2**32-1] range.
static void set_seed(int)
Set seed.
static Rng get()
Return pseudo-random number generator.
This rng returns a double in the [0,1[ range.