13 #ifndef __MLPACK_CORE_MATH_RANDOM_HPP 14 #define __MLPACK_CORE_MATH_RANDOM_HPP 38 randGen.seed((uint32_t) seed);
39 srand((
unsigned int) seed);
40 #if ARMA_VERSION_MAJOR > 3 || \ 41 (ARMA_VERSION_MAJOR == 3 && ARMA_VERSION_MINOR >= 930) 44 arma::arma_rng::set_seed(seed);
59 inline double Random(
const double lo,
const double hi)
69 return (
int) std::floor((
double) hiExclusive *
randUniformDist(randGen));
75 inline int RandInt(
const int lo,
const int hiExclusive)
77 return lo + (int) std::floor((
double) (hiExclusive - lo)
96 inline double RandNormal(
const double mean,
const double variance)
104 #endif // __MLPACK_CORE_MATH_MATH_LIB_HPP std::uniform_real_distribution randUniformDist
Linear algebra utility functions, generally performed on matrices or vectors.
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.
int RandInt(const int hiExclusive)
Generates a uniform random integer.
std::normal_distribution randNormalDist