shark::BaseRng< RNG > Class Template Reference

Collection of different variate generators for different distributions. More...

#include <shark/Rng/GlobalRng.h>

Static Public Member Functions

static bool coinToss (double p=0.5)
 creates a bernoulli distributed number with propability "p" More...
 
static std::size_t discrete (std::size_t min=0, std::size_t max=1)
 creates a discrete uniform distributed number in the range from "min" to "max" More...
 
static double uni (double min=0.0, double max=1.0)
 creates a uniform distributed number in the range from "min" to "max" More...
 
static double logNormal (double location=0.0, double scale=1.0)
 creates a log-normal distributed number with location "location" and scale "scale" More...
 
static double gauss (double mean=0.0, double sigma=1.0)
 creates a normal distributed number with mean "mean" and variance "sigma" More...
 
static double cauchy (double median=0.0, double gamma=1.0)
 creates a cauchy distributed number More...
 
static int geom (double p=0.0)
 creates a number using the geometric distribution and propability "p" More...
 
static int diffGeom (double mean=0.5)
 creates a number using the diff-geometric distribution with mean "mean" More...
 
static double poisson (double mean=0.01)
 creates a poission distributed number with mean "mean" More...
 
static double gam (double k, double theta)
 creates a number using the gamma distribution More...
 
static std::vector< double > dir (size_t n, double alpha)
 creates a dirichlet distributed number More...
 
static std::vector< double > dir (const std::vector< double > &alphas)
 creates a dirichlet distributed number More...
 
static void seed (typename rng_type::result_type s)
 Sets the seed for all random number generators to "s". More...
 

Static Public Attributes

static rng_type globalRng = typename BaseRng<Rng>::rng_type()
 The global random number generator used by all distributions. More...
 

Detailed Description

template<typename RNG>
class shark::BaseRng< RNG >

Collection of different variate generators for different distributions.

Template Parameters
RNGThe underlying random number generator, needs to model the boost rng concept.

Definition at line 117 of file GlobalRng.h.

Member Function Documentation

◆ cauchy()

template<typename RNG>
static double shark::BaseRng< RNG >::cauchy ( double  median = 0.0,
double  gamma = 1.0 
)
inlinestatic

creates a cauchy distributed number

Definition at line 160 of file GlobalRng.h.

Referenced by shark::BaseRng< RNG >::gam().

◆ coinToss()

template<typename RNG>
static bool shark::BaseRng< RNG >::coinToss ( double  p = 0.5)
inlinestatic

creates a bernoulli distributed number with propability "p"

Definition at line 127 of file GlobalRng.h.

◆ diffGeom()

template<typename RNG>
static int shark::BaseRng< RNG >::diffGeom ( double  mean = 0.5)
inlinestatic

creates a number using the diff-geometric distribution with mean "mean"

Definition at line 172 of file GlobalRng.h.

References shark::mean().

◆ dir() [1/2]

template<typename RNG>
static std::vector<double> shark::BaseRng< RNG >::dir ( size_t  n,
double  alpha 
)
inlinestatic

creates a dirichlet distributed number

Definition at line 190 of file GlobalRng.h.

◆ dir() [2/2]

template<typename RNG>
static std::vector<double> shark::BaseRng< RNG >::dir ( const std::vector< double > &  alphas)
inlinestatic

creates a dirichlet distributed number

Definition at line 195 of file GlobalRng.h.

◆ discrete()

template<typename RNG>
static std::size_t shark::BaseRng< RNG >::discrete ( std::size_t  min = 0,
std::size_t  max = 1 
)
inlinestatic

creates a discrete uniform distributed number in the range from "min" to "max"

Definition at line 133 of file GlobalRng.h.

References remora::max(), and remora::min().

◆ gam()

template<typename RNG>
static double shark::BaseRng< RNG >::gam ( double  k,
double  theta 
)
inlinestatic

creates a number using the gamma distribution

Definition at line 184 of file GlobalRng.h.

References shark::BaseRng< RNG >::cauchy().

◆ gauss()

template<typename RNG>
static double shark::BaseRng< RNG >::gauss ( double  mean = 0.0,
double  sigma = 1.0 
)
inlinestatic

creates a normal distributed number with mean "mean" and variance "sigma"

Definition at line 154 of file GlobalRng.h.

References shark::mean().

◆ geom()

template<typename RNG>
static int shark::BaseRng< RNG >::geom ( double  p = 0.0)
inlinestatic

creates a number using the geometric distribution and propability "p"

Definition at line 166 of file GlobalRng.h.

◆ logNormal()

template<typename RNG>
static double shark::BaseRng< RNG >::logNormal ( double  location = 0.0,
double  scale = 1.0 
)
inlinestatic

creates a log-normal distributed number with location "location" and scale "scale"

Definition at line 148 of file GlobalRng.h.

◆ poisson()

template<typename RNG>
static double shark::BaseRng< RNG >::poisson ( double  mean = 0.01)
inlinestatic

creates a poission distributed number with mean "mean"

Definition at line 178 of file GlobalRng.h.

References shark::mean().

◆ seed()

template<typename RNG>
static void shark::BaseRng< RNG >::seed ( typename rng_type::result_type  s)
inlinestatic

Sets the seed for all random number generators to "s".

Definition at line 201 of file GlobalRng.h.

◆ uni()

template<typename RNG>
static double shark::BaseRng< RNG >::uni ( double  min = 0.0,
double  max = 1.0 
)
inlinestatic

creates a uniform distributed number in the range from "min" to "max"

Definition at line 141 of file GlobalRng.h.

References remora::max(), and remora::min().

Member Data Documentation

◆ globalRng

template<typename RNG>
BaseRng< Rng >::rng_type shark::BaseRng< Rng >::globalRng = typename BaseRng<Rng>::rng_type()
static

The global random number generator used by all distributions.

Definition at line 124 of file GlobalRng.h.


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