30 #include <boost/cstdint.hpp>
31 #include <boost/random/lagged_fibonacci.hpp>
32 #include <boost/random/mersenne_twister.hpp>
33 #include <boost/thread/locks.hpp>
34 #include <boost/thread/mutex.hpp>
38 #include "serialization.h"
47 class __PAGMO_VISIBLE
rng_uint32:
public boost::mt19937 {
48 friend class boost::serialization::access;
66 template <
class Archive>
67 void save(Archive &ar,
const unsigned int)
const
70 ss << *static_cast<boost::mt19937 const *>(
this);
71 std::string tmp(ss.str());
74 template <
class Archive>
75 void load(Archive &ar,
const unsigned int)
79 std::stringstream ss(tmp);
80 ss >> *
static_cast<boost::mt19937 *
>(
this);
82 BOOST_SERIALIZATION_SPLIT_MEMBER()
89 class __PAGMO_VISIBLE
rng_double:
public boost::lagged_fibonacci607 {
90 friend class boost::serialization::access;
104 template <
class Archive>
105 void save(Archive &ar,
const unsigned int)
const
107 std::stringstream ss;
108 ss << *static_cast<boost::lagged_fibonacci607 const *>(
this);
109 std::string tmp(ss.str());
112 template <
class Archive>
113 void load(Archive &ar,
const unsigned int)
117 std::stringstream ss(tmp);
118 ss >> *
static_cast<boost::lagged_fibonacci607 *
>(
this);
120 BOOST_SERIALIZATION_SPLIT_MEMBER()
151 static void set_seed(
int);
154 static boost::mutex m_mutex;
Generic thread-safe generator of pseudo-random number generators.
This rng returns an unsigned integer in the [0,2**32-1] range.
rng_double(const boost::uint32_t &n)
Constructor from unsigned integer.
boost::mt19937::result_type result_type
Return value of the generator.
rng_double()
Default constructor.
rng_uint32()
Default constructor.
rng_uint32(const result_type &n)
Constructor from unsigned integer.
This rng returns a double in the [0,1[ range.