Go to the documentation of this file.
37 #ifndef RANDOM_NUMBERS_RANDOM_NUMBERS_
38 #define RANDOM_NUMBERS_RANDOM_NUMBERS_
40 #include <boost/random/mersenne_twister.hpp>
41 #include <boost/random/uniform_real.hpp>
42 #include <boost/random/uniform_int.hpp>
43 #include <boost/random/variate_generator.hpp>
44 #include <boost/random/normal_distribution.hpp>
74 double uniformReal(
double lower_bound,
double upper_bound)
76 return (upper_bound - lower_bound) *
uni_() + lower_bound;
88 return normal_() * stddev + mean;
99 boost::uniform_int<> dis(min, max);
113 boost::variate_generator<boost::mt19937&, boost::uniform_real<> >
uni_;
114 boost::variate_generator<boost::mt19937&, boost::normal_distribution<> >
normal_;
double uniform01(void)
Generate a random real between 0 and 1.
double gaussian01(void)
Generate a random real using a normal distribution with mean 0 and variance 1.
double uniformReal(double lower_bound, double upper_bound)
Generate a random real within given bounds: [lower_bound, upper_bound)
double gaussian(double mean, double stddev)
Generate a random real using a normal distribution with given mean and variance.
void quaternion(double value[4])
Uniform random unit quaternion sampling. The computed value has the order (x,y,z,w)
boost::normal_distribution normalDist_
boost::variate_generator< boost::mt19937 &, boost::uniform_real<> > uni_
boost::uniform_real uniDist_
Random number generation (wrapper for boost). An instance of this class cannot be used by multiple th...
boost::uint32_t getFirstSeed()
Allow the randomly generated seed to be saved so that experiments / benchmarks can be recreated in th...
RandomNumberGenerator(void)
Constructor. Always sets a "random" random seed.
boost::variate_generator< boost::mt19937 &, boost::normal_distribution<> > normal_
int uniformInteger(int min, int max)
Generate an integer uniformly at random within a specified range (inclusive)
boost::mt19937 generator_
random_numbers
Author(s): Ioan Sucan
autogenerated on Mon Oct 14 2024 02:13:08