Evoplex  0.2.1
Public Member Functions | List of all members
evoplex::PRG Class Reference

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 >
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 >
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 >
uniform (std::uniform_real_distribution< T > d)
 Uniform continuous distribution for random numbers.
 
template<typename T >
uniform (std::uniform_int_distribution< T > d)
 Uniform discrete distribution for random numbers.
 

Detailed Description

Pseudo-random number generator.

Based on the classic Mersenne Twister (std::mt19937).

Constructor & Destructor Documentation

◆ PRG()

evoplex::PRG::PRG ( unsigned int  seed)
explicit

PRG constructor.

Parameters
seedThe pseudo-random generator seed.

Member Function Documentation

◆ bernoulli()

bool evoplex::PRG::bernoulli ( double  p)
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).


The documentation for this class was generated from the following file: