Graph C++ Library
 All Classes Namespaces Files Functions Variables Typedefs Groups Pages
Functions
Random Number Generators

Functions related to the generation of random numbers. More...

Functions

double rng::powerlaw_rand (std::vector< double > &param, std::mt19937 &_engine)
 Generates a random real number following a power-law distribution of the form $\rho(x) \propto x^{-\gamma}$ with $x\in(x_\mathrm{min},\infty)$. More...
 
double rng::powerlaw_m1 (std::vector< double > &param)
 Returns the first moment of a power-law distribution of the form $\rho(x) \propto x^{-\gamma}$ with $x\in(x_\mathrm{min},\infty)$. More...
 
double rng::powerlaw_hardcutoff_rand (std::vector< double > &param, std::mt19937 &_engine)
 Generates a random real number following a power-law distribution of the form $\rho(x)\propto x^{-\gamma}$ with $x\in(x_\mathrm{min},x_\mathrm{max})$ (i.e., hard cut-off). More...
 
double rng::powerlaw_hardcutoff_m1 (std::vector< double > &param)
 Returns the first moment of a power-law distribution of the form $\rho(x) \propto x^{-\gamma}$ with $x\in(x_\mathrm{min},x_\mathrm{max})$ (i.e., hard cut-off). More...
 
double rng::exponential_rand (std::vector< double > &param, std::mt19937 &_engine)
 Generates a random real number following an exponential distribution of the form $\rho(x)\propto \mathrm{e}^{-x/\beta}$ with $x\in(0,\infty)$. More...
 
double rng::exponential_m1 (double param)
 Returns the first moment of an exponential distribution of the form $\rho(x)\propto \mathrm{e}^{-x/\beta}$ with $x\in(0,\infty)$. More...
 
double rng::gamma_rand (std::vector< double > &param, std::mt19937 &_engine)
 Generates a random real number following a gamma distribution of the form $\rho(x)\propto x^{\alpha-1}\mathrm{e}^{-x/\beta}$ with $x\in(0,\infty)$. More...
 
double rng::gamma_m1 (std::vector< double > param)
 Returns the first moment of a gamma distribution of the form $\rho(x)\propto x^{\alpha-1}\mathrm{e}^{-x/\beta}$ with $x\in(0,\infty)$. More...
 

Detailed Description

Functions related to the generation of random numbers.

Set of functions that generate random numbers from a variety of distributions and provides some of their moments and cumulants. Notice that all the functions listed in this group are within the "rng" namespace.

Function Documentation

double rng::exponential_m1 ( double  param)

Returns the first moment of an exponential distribution of the form $\rho(x)\propto \mathrm{e}^{-x/\beta}$ with $x\in(0,\infty)$.

Parameters
param[0]Scale parameter ( $\beta$).
Returns
Average of an exponential distribution defined by scale parameter $\beta$.
double rng::exponential_rand ( std::vector< double > &  param,
std::mt19937 &  _engine 
)

Generates a random real number following an exponential distribution of the form $\rho(x)\propto \mathrm{e}^{-x/\beta}$ with $x\in(0,\infty)$.

Parameters
param[0]Scale parameter ( $\beta$).
Returns
Real number between 0 and $\infty$ distributed as an exponential distribution with scale parameter $\beta$.
double rng::gamma_m1 ( std::vector< double >  param)

Returns the first moment of a gamma distribution of the form $\rho(x)\propto x^{\alpha-1}\mathrm{e}^{-x/\beta}$ with $x\in(0,\infty)$.

Parameters
param[0]Shape parameter ( $\alpha$).
param[1]Scale parameter ( $\beta$).
Returns
Average of a gamma distribution defined by shape parameter $\alpha$ and scale parameter $\beta$.
double rng::gamma_rand ( std::vector< double > &  param,
std::mt19937 &  _engine 
)

Generates a random real number following a gamma distribution of the form $\rho(x)\propto x^{\alpha-1}\mathrm{e}^{-x/\beta}$ with $x\in(0,\infty)$.

Parameters
param[0]Shape parameter ( $\alpha$).
param[1]Scale parameter ( $\beta$).
Returns
Real number between 0 and $\infty$ distributed as a gamma distribution with a shape parameter $\alpha$ and a scale parameter $\beta$.
double rng::powerlaw_hardcutoff_m1 ( std::vector< double > &  param)

Returns the first moment of a power-law distribution of the form $\rho(x) \propto x^{-\gamma}$ with $x\in(x_\mathrm{min},x_\mathrm{max})$ (i.e., hard cut-off).

Parameters
param[0]Exponent of the distribution ( $\gamma$).
param[1]Lower bound of the distribution ( $x_\mathrm{min}$).
param[2]Upper bound of the distribution ( $x_\mathrm{max}$).
Returns
Average of a power-law distribution defined by exponent $\gamma$, a lower bound $x_\mathrm{min}$ and a upper bound $x_\mathrm{max}$.
double rng::powerlaw_hardcutoff_rand ( std::vector< double > &  param,
std::mt19937 &  _engine 
)

Generates a random real number following a power-law distribution of the form $\rho(x)\propto x^{-\gamma}$ with $x\in(x_\mathrm{min},x_\mathrm{max})$ (i.e., hard cut-off).

Parameters
param[0]Exponent of the distribution ( $\gamma$).
param[1]Lower bound of the distribution ( $x_\mathrm{min}$).
param[2]Upper bound of the distribution ( $x_\mathrm{max}$).
Returns
Real number between $x_\mathrm{min}$ and $x_\mathrm{max}$ distributed as a power-law distribution with exponent $\gamma$.
double rng::powerlaw_m1 ( std::vector< double > &  param)

Returns the first moment of a power-law distribution of the form $\rho(x) \propto x^{-\gamma}$ with $x\in(x_\mathrm{min},\infty)$.

Parameters
param[0]Exponent of the distribution ( $\gamma$).
param[1]Lower bound of the distribution ( $x_\mathrm{min}$).
Returns
Average of a power-law distribution defined by exponent $\gamma$ and lower bound $x_\mathrm{min}$. Returns infinite if the average diverges, and print a warning message on screen.
double rng::powerlaw_rand ( std::vector< double > &  param,
std::mt19937 &  _engine 
)

Generates a random real number following a power-law distribution of the form $\rho(x) \propto x^{-\gamma}$ with $x\in(x_\mathrm{min},\infty)$.

Parameters
param[0]Exponent of the distribution ( $\gamma$).
param[1]Lower bound of the distribution ( $x_\mathrm{min}$).
Returns
Real number between $x_\mathrm{min}$ and $\infty$ distributed as a power-law distribution with exponent $\gamma$.