Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
hgps::Random Class Reference

General purpose Random number generator algorithms. More...

#include <random_algorithm.h>

Public Member Functions

void seed (unsigned int seed) noexcept
 Set a new seed value for the random number generator.
 
int next_int ()
 Generates the next random integer in the sequence.
 
int next_int (int max_value)
 Generates the next random integer in sequence in range [min(), max_value)
 
int next_int (int min_value, int max_value)
 Generates the next random integer in sequence in range [min_value, max_value)
 
double next_double () noexcept
 Generates a random floating point number in range [0,1)
 
double next_normal ()
 Generates the next random number from a standard normal distribution.
 
double next_normal (double mean, double standard_deviation)
 Generates the next random number from a normal distribution.
 
int next_empirical_discrete (const std::vector< int > &values, const std::vector< float > &cdf)
 Samples a random value from an empirical distribution.
 
int next_empirical_discrete (const std::vector< int > &values, const std::vector< double > &cdf)
 Samples a random value from an empirical distribution.
 

Detailed Description

General purpose Random number generator algorithms.

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 call graph for this function:
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 call graph for this function:
Here is the caller graph for this function:

◆ next_int() [2/3]

int hgps::Random::next_int ( 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 ( int  min_value,
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 call graph for this function:
Here is the caller graph for this function:

◆ next_normal() [2/2]

double hgps::Random::next_normal ( double  mean,
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

◆ seed()

void hgps::Random::seed ( unsigned int  seed)
noexcept

Set a new seed value for the random number generator.

Parameters
seedThe new seed value

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