10 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
11 #pragma GCC diagnostic push
12 #pragma GCC system_header
15 #include <boost/random.hpp>
17 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
18 #pragma GCC diagnostic pop
62 void seed(quint64 seed);
72 double range(
const double low=0.0,
const double high=1.0);
79 double normal(
const double mean,
const double sigma);
84 int integer(
const int low=0,
const int high=1);
91 bool metropolis(
double energyChange,
double inversekT);
156 boost::variate_generator<boost::mt19937&, boost::uniform_01<double> >*
generator01;
A class to generate random numbers.
Definition: rand.h:31
double normal(const double mean, const double sigma)
Generate a random double from the normal distribution.
boost::variate_generator< boost::mt19937 &, boost::uniform_01< double > > * generator01
The underlying generator coupled to the uniform distribution on [0,1].
Definition: rand.h:156
~Random()
Destroy objects.
bool metropolis(double energyChange, double inversekT)
Randomly choose yes using a Boltzmann factor.
int integer(const int low=0, const int high=1)
Generate a random int from the uniform distribution [low, high].
quint64 seed()
Get the seed that was used.
Random(quint64 seed=0, QObject *parent=0)
Random.
double range(const double low=0.0, const double high=1.0)
Generate a random double from the uniform distribution [low, high].
friend QDataStream & operator>>(QDataStream &stream, Random &random)
Load the random state from a QDataStream Possibly Broken.
quint64 m_seed
The seed used to start the generator.
Definition: rand.h:161
double random()
Generate a random double from the uniform distribution [0, 1].
boost::mt19937 * twister
The underlying random number generator.
Definition: rand.h:151
bool chooseNo(double percent)
Randomly choose no a percent of the time.
friend QDataStream & operator<<(QDataStream &stream, Random &random)
Output the random state to a QDataStream Possibly Broken.
bool metropolisWithCoupling(double energyChange, double inversekT, double coupling)
Randomly choose yes using a Boltzmann factor and coupling constant.
bool chooseYes(double percent)
Randomly choose yes a percent of the time.