Evoplex
0.2.1
|
Pseudo-random number generator. More...
#include <prg.h>
Public Member Functions | |
PRG (unsigned int seed) | |
PRG constructor. More... | |
unsigned int | seed () const |
Gets the initial PRG seed. | |
bool | bernoulli (double p) |
Bernoulli distribution. More... | |
bool | bernoulli () |
randBernoulli(p=0.5) alias. | |
template<typename T > | |
T | uniform (T min, T max) |
Generates a random double/float [min, max). | |
int | uniform (int min, int max) |
Generates a random integer [min, max]. | |
size_t | uniform (size_t min, size_t max) |
Generates a random size_t [min, max]. | |
template<typename T > | |
T | uniform (T max) |
Generates a random double/float [0, max). | |
int | uniform (int max) |
Generates a random integer [0, max]. | |
size_t | uniform (size_t max) |
Generates a random size_t [0, max]. | |
double | uniform () |
Generates a random double [0, 1). | |
template<typename T > | |
T | uniform (std::uniform_real_distribution< T > d) |
Uniform continuous distribution for random numbers. | |
template<typename T > | |
T | uniform (std::uniform_int_distribution< T > d) |
Uniform discrete distribution for random numbers. | |
Pseudo-random number generator.
Based on the classic Mersenne Twister (std::mt19937).
|
explicit |
PRG constructor.
seed | The pseudo-random generator seed . |
|
inline |
Bernoulli distribution.
It generates a random boolean according to the discrete probability function, where the probability of true is p
and the probability of false is (1-p).