21 #ifndef __MLPACK_CORE_MATH_RANDOM_HPP
22 #define __MLPACK_CORE_MATH_RANDOM_HPP
28 #include <boost/random.hpp>
34 #include <boost/version.hpp>
36 #if BOOST_VERSION >= 104700
38 extern boost::random::mt19937
randGen;
47 #if BOOST_VERSION >= 103900
69 srand((
unsigned int) seed);
77 #if BOOST_VERSION >= 103900
89 inline double Random(
const double lo,
const double hi)
91 #if BOOST_VERSION >= 103900
105 #if BOOST_VERSION >= 103900
117 inline int RandInt(
const int lo,
const int hiExclusive)
119 #if BOOST_VERSION >= 103900
120 return lo + (int) std::floor((
double) (hiExclusive - lo)
125 return lo + (int) std::floor((
double) (hiExclusive - lo)
146 inline double RandNormal(
const double mean,
const double variance)
154 #endif // __MLPACK_CORE_MATH_MATH_LIB_HPP
boost::uniform_01< boost::mt19937, double > randUniformDist
void RandomSeed(const size_t seed)
Set the random seed used by the random functions (Random() and RandInt()).
double RandNormal()
Generates a normally distributed random number with mean 0 and variance 1.
double Random()
Generates a uniform random number between 0 and 1.
boost::normal_distribution randNormalDist
int RandInt(const int hiExclusive)
Generates a uniform random integer.