Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::Random Class Reference

General purpose Random number generator algorithms. More...

#include <random_algorithm.h>

Public Member Functions

 Random ()=delete
 
 Random (RandomBitGenerator &generator)
 Initialise a new instance of the Random class. More...
 
int next_int ()
 Generates the next random integer in the sequence. More...
 
int next_int (const int &max_value)
 Generates the next random integer in sequence in range [min(), max_value) More...
 
int next_int (const int &min_value, const int &max_value)
 Generates the next random integer in sequence in range [min_value, max_value) More...
 
double next_double () noexcept
 Generates a random floating point number in range [0,1) More...
 
double next_normal ()
 Generates the next random number from a standard normal distribution. More...
 
double next_normal (const double &mean, const double &standard_deviation)
 Generates the next random number from a normal distribution. More...
 
int next_empirical_discrete (const std::vector< int > &values, const std::vector< float > &cdf)
 Samples a random value from an empirical distribution. More...
 
int next_empirical_discrete (const std::vector< int > &values, const std::vector< double > &cdf)
 Samples a random value from an empirical distribution. More...
 

Detailed Description

General purpose Random number generator algorithms.

Constructor & Destructor Documentation

◆ Random() [1/2]

hgps::Random::Random ( )
delete

◆ Random() [2/2]

hgps::Random::Random ( RandomBitGenerator generator)

Initialise a new instance of the Random class.

Parameters
generatorUnderline pseudo-random number engine instance

Member Function Documentation

◆ next_double()

double hgps::Random::next_double ( )
noexcept

Generates a random floating point number in range [0,1)

Returns
A floating point value in range [0,1).
Here is the caller graph for this function:

◆ next_empirical_discrete() [1/2]

int hgps::Random::next_empirical_discrete ( const std::vector< int > &  values,
const std::vector< double > &  cdf 
)

Samples a random value from an empirical distribution.

Parameters
valuesThe empirical distribution values
cdfThe cumulative distribution values
Returns
The random select value
Here is the call graph for this function:

◆ next_empirical_discrete() [2/2]

int hgps::Random::next_empirical_discrete ( const std::vector< int > &  values,
const std::vector< float > &  cdf 
)

Samples a random value from an empirical distribution.

Parameters
valuesThe empirical distribution values
cdfThe cumulative distribution values
Returns
The random select value
Here is the call graph for this function:

◆ next_int() [1/3]

int hgps::Random::next_int ( )

Generates the next random integer in the sequence.

Returns
A random integer value in range [min(), max())
Here is the caller graph for this function:

◆ next_int() [2/3]

int hgps::Random::next_int ( const int &  max_value)

Generates the next random integer in sequence in range [min(), max_value)

Parameters
max_valueThe maximum value
Returns
A random integer value in range [min(), max_value)
Here is the call graph for this function:

◆ next_int() [3/3]

int hgps::Random::next_int ( const int &  min_value,
const int &  max_value 
)

Generates the next random integer in sequence in range [min_value, max_value)

Parameters
min_valueThe minimum value
max_valueThe maximum value
Returns
A random integer value in range [min_value, max_value)

◆ next_normal() [1/2]

double hgps::Random::next_normal ( )

Generates the next random number from a standard normal distribution.

Returns
The generated floating point random number
Here is the caller graph for this function:

◆ next_normal() [2/2]

double hgps::Random::next_normal ( const double &  mean,
const double &  standard_deviation 
)

Generates the next random number from a normal distribution.

Parameters
meanThe mean parameter
standard_deviationThe standard deviation parameter
Returns
The generated floating point random number

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