PhyStar  v0.0.0 thu24
RandomNumber< T_real > Struct Template Reference

#include <randomtools.h>

Static Public Member Functions

static T_real randr (T_real low, T_real high)
 Return a random Real between [lo, hi) More...
 
static T_real randr ()
 Return a random Real between [0, 1) More...
 
static T_real Normalr ()
 Return a standard normal random Real. More...
 
static T_real Normal_log_prob (T_real x, T_real mu, T_real sigma)
 Return the log probability of given normal distribution. More...
 
static void setRandomSeed (unsigned randomSeed)
 
static int randi (int low, int high)
 

Static Public Attributes

static std::default_random_engine re
 
static std::uniform_real_distribution< T_real > default_real_distr {0.0, 1.0}
 
static std::normal_distribution< T_real > standard_normal_distr {0.0, 1.0}
 

Member Function Documentation

◆ Normal_log_prob()

template<typename T_real = double>
static T_real RandomNumber< T_real >::Normal_log_prob ( T_real  x,
T_real  mu,
T_real  sigma 
)
inlinestatic

Return the log probability of given normal distribution.

Template Parameters
T_realReal Type
Parameters
xthe normal random number
muthe mean of distribution
sigmathe variance of the distribution
Returns
T_real Real type

◆ Normalr()

template<typename T_real = double>
static T_real RandomNumber< T_real >::Normalr ( )
inlinestatic

Return a standard normal random Real.

Template Parameters
T_realReal type
Returns
T_real: Real type

References RandomNumber< T_real >::re, and RandomNumber< T_real >::standard_normal_distr.

Here is the caller graph for this function:

◆ randi()

template<typename T_real = double>
static int RandomNumber< T_real >::randi ( int  low,
int  high 
)
inlinestatic

◆ randr() [1/2]

template<typename T_real = double>
static T_real RandomNumber< T_real >::randr ( )
inlinestatic

Return a random Real between [0, 1)

Template Parameters
T_realReal type
Parameters
lolower bound
hiupper bound (not included)
Returns
T_real: Real type
Here is the caller graph for this function:

◆ randr() [2/2]

template<typename T_real = double>
static T_real RandomNumber< T_real >::randr ( T_real  low,
T_real  high 
)
inlinestatic

Return a random Real between [lo, hi)

Template Parameters
T_realReal type
Parameters
lowlower bound
highupper bound (not included)
Returns
T_real: Real type

References RandomNumber< T_real >::re.

◆ setRandomSeed()

template<typename T_real = double>
static void RandomNumber< T_real >::setRandomSeed ( unsigned  randomSeed)
inlinestatic

References RandomNumber< T_real >::re.

Here is the caller graph for this function:

Member Data Documentation

◆ default_real_distr

template<typename T_real = double>
std::uniform_real_distribution<T_real> RandomNumber< T_real >::default_real_distr {0.0, 1.0}
inlinestatic

◆ re

template<typename T_real = double>
std::default_random_engine RandomNumber< T_real >::re
inlinestatic

◆ standard_normal_distr

template<typename T_real = double>
std::normal_distribution<T_real> RandomNumber< T_real >::standard_normal_distr {0.0, 1.0}
inlinestatic

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