21 #ifndef __MLPACK_CORE_MATH_RANDOM_HPP
22 #define __MLPACK_CORE_MATH_RANDOM_HPP
25 #include <boost/random.hpp>
31 #include <boost/version.hpp>
33 #if BOOST_VERSION >= 104700
35 extern boost::random::mt19937
randGen;
44 #if BOOST_VERSION >= 103900
66 srand((
unsigned int) seed);
74 #if BOOST_VERSION >= 103900
86 inline double Random(
const double lo,
const double hi)
88 #if BOOST_VERSION >= 103900
102 #if BOOST_VERSION >= 103900
114 inline int RandInt(
const int lo,
const int hiExclusive)
116 #if BOOST_VERSION >= 103900
117 return lo + (int) std::floor((
double) (hiExclusive - lo)
122 return lo + (int) std::floor((
double) (hiExclusive - lo)
143 inline double RandNormal(
const double mean,
const double variance)
151 #endif // __MLPACK_CORE_MATH_MATH_LIB_HPP
boost::uniform_01< boost::mt19937, double > randUniformDist
The core includes that mlpack expects; standard C++ includes and Armadillo.
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.