shark::BaseRng< RNG > Class Template Reference

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

#include <shark/Rng/GlobalRng.h>

+ Collaboration diagram for shark::BaseRng< RNG >:

Static Public Member Functions

static bool coinToss (double p=0.5)
 creates a bernoulli distributed number with propability "p" More...
 
static int discrete (int min=0, int 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 114 of file GlobalRng.h.

Member Function Documentation

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 155 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng.

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

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 124 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng.

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 167 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng, and shark::mean().

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 185 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng.

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 190 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng.

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

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

Definition at line 130 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng, shark::blas::max(), and shark::blas::min().

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

creates a number using the gamma distribution

Definition at line 179 of file GlobalRng.h.

References shark::BaseRng< RNG >::cauchy(), and shark::BaseRng< RNG >::globalRng.

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 149 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng, and shark::mean().

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 161 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng.

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 143 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng.

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 173 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng, and shark::mean().

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 196 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng.

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 137 of file GlobalRng.h.

References shark::BaseRng< RNG >::globalRng, shark::blas::max(), and shark::blas::min().

Member Data Documentation


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