shark::random Namespace Reference

Functions

template<class RngType >
bool coinToss (RngType &rng, double pHeads=0.5)
 Flips a coin with probability of heads being pHeads by drawing random numbers from rng. More...
 
template<class RngType >
double uni (RngType &rng, double lower=0.0, double upper=1.0)
 Draws a number uniformly in [lower,upper] by drawing random numbers from rng. More...
 
template<class RngType , class T >
discrete (RngType &rng, T low, T high)
 Draws a discrete number in {low,low+1,...,high} by drawing random numbers from rng. More...
 
template<class RngType >
double gauss (RngType &rng, double mean=0.0, double variance=1.0)
 Draws a number from the normal distribution with given mean and variance by drawing random numbers from rng. More...
 
template<class RngType >
double logNormal (RngType &rng, double m=0.0, double v=1.0)
 Draws a number from the log-normal distribution as exp(gauss(m,v)) More...
 
template<class RngType >
double truncExp (RngType &rng, double lambda, double maximum, double Z=-1.0)
 draws a number from the truncated exponential distribution More...
 

Variables

SHARK_EXPORT_SYMBOL rng_type globalRng
 

Function Documentation

◆ coinToss()

◆ discrete()

◆ gauss()

◆ logNormal()

template<class RngType >
double shark::random::logNormal ( RngType &  rng,
double  m = 0.0,
double  v = 1.0 
)

Draws a number from the log-normal distribution as exp(gauss(m,v))

Definition at line 76 of file Random.h.

References gauss().

Referenced by main().

◆ truncExp()

template<class RngType >
double shark::random::truncExp ( RngType &  rng,
double  lambda,
double  maximum,
double  Z = -1.0 
)

draws a number from the truncated exponential distribution

draws from the exponential distribution p(x|lambda)= 1/Z exp(-lambda*x) subject to x < maximum as optuonal third argument it is possible to return the precomputed value of Z.

Definition at line 85 of file Random.h.

References lambda, and uni().

Referenced by shark::TruncatedExponentialLayer::sample().

◆ uni()

Variable Documentation

◆ globalRng