36 #ifndef RANDOMNUMBERGENERATORS_HPP_
37 #define RANDOMNUMBERGENERATORS_HPP_
40 #include <boost/shared_ptr.hpp>
41 #include <boost/version.hpp>
44 #if BOOST_VERSION < 105600
49 #include <boost/random.hpp>
52 #include "SerializableSingleton.hpp"
53 #include <boost/serialization/split_member.hpp>
71 #if BOOST_VERSION < 105600 //#2585
79 friend class boost::serialization::access;
89 template<
class Archive>
90 void save(Archive & archive,
const unsigned int version)
const
92 std::stringstream rng_internals;
94 std::string rng_internals_string = rng_internals.str();
95 archive & rng_internals_string;
97 std::stringstream normal_internals;
98 #if BOOST_VERSION < 105600 //#2585
103 normal_internals << r_normal_dist;
104 std::string normal_internals_string = normal_internals.str();
105 archive & normal_internals_string;
117 template<
class Archive>
118 void load(Archive & archive,
const unsigned int version)
120 std::string rng_internals_string;
121 archive & rng_internals_string;
122 std::stringstream rng_internals(rng_internals_string);
125 std::string normal_internals_string;
126 archive & normal_internals_string;
127 std::stringstream normal_internals(normal_internals_string);
130 BOOST_SERIALIZATION_SPLIT_MEMBER()
184 unsigned randMod(
unsigned base);
194 void Shuffle(std::vector<boost::shared_ptr<T> >& rValues)
196 unsigned num = rValues.size();
201 for (
unsigned end=num-1; end>0; end--)
205 boost::shared_ptr<T> temp = rValues[end];
206 rValues[end] = rValues[k];
220 void Shuffle(
unsigned num, std::vector<unsigned>& rValues);
241 void Reseed(
unsigned seed);
boost::variate_generator< boost::mt19937 &, boost::random::normal_distribution_v156<> > mGenerateStandardNormal
unsigned randMod(unsigned base)
void Reseed(unsigned seed)
static RandomNumberGenerator * mpInstance
double NormalRandomDeviate(double mean, double stdDev)
void Shuffle(std::vector< boost::shared_ptr< T > > &rValues)
boost::variate_generator< boost::mt19937 &, boost::uniform_real<> > mGenerateUnitReal
void save(Archive &archive, const unsigned int version) const
boost::mt19937 mMersenneTwisterGenerator
static RandomNumberGenerator * Instance()
double StandardNormalRandomDeviate()
double GammaRandomDeviate(double shape, double scale)
void load(Archive &archive, const unsigned int version)
double ExponentialRandomDeviate(double scale)