Version: SMASH-3.1
random.h File Reference
#include <cassert>
#include <limits>
#include <random>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  smash::random::uniform_dist< T >
 Provides uniform random numbers on a fixed interval. More...
 
class  smash::random::discrete_dist< T >
 Discrete distribution with weight given by probability vector. More...
 
class  smash::random::BesselSampler
 The intention of this class is to efficiently sample \( (N_1, N_2) \) from the Bessel distribution \( p(N_1,N_2) \sim \mathrm{Poi}(\nu_1) \mathrm{Poi}(\nu_2) \delta(N_1 - N_2 = N)\), where \(\mathrm{Poi}(\nu)\) denotes Poisson distribution with mean \(\nu\). More...
 

Namespaces

 smash
 
 smash::random
 Namespace random provides functions for random Number Generation.
 

Typedefs

using smash::random::Engine = std::mt19937_64
 The random number engine used is the Mersenne Twister. More...
 

Functions

int64_t smash::random::generate_63bit_seed ()
 Generates a seed with a truly random 63-bit value, if possible. More...
 
template<typename T >
void smash::random::set_seed (T &&seed)
 Sets the seed of the random number engine. More...
 
Engine::result_type smash::random::advance ()
 Advance the engine's state and return the generated value. More...
 
template<typename T >
smash::random::uniform (T min, T max)
 
template<typename T >
smash::random::uniform_int (T min, T max)
 
template<typename T = double>
smash::random::canonical ()
 
template<typename T = double>
smash::random::canonical_nonzero ()
 
template<typename T >
uniform_dist< T > smash::random::make_uniform_distribution (T min, T max)
 
template<typename T = double>
smash::random::exponential (T lambda)
 Draws an exponentially distributed random number. More...
 
template<typename T = double>
smash::random::expo (T A, T x1, T x2)
 Draws a random number x from an exponential distribution exp(A*x), where A is assumed to be positive, and x is typically negative. More...
 
template<typename T >
int smash::random::sgn (T val)
 Signum function. More...
 
template<typename T = double>
smash::random::power (T n, T xMin, T xMax)
 Draws a random number according to a power-law distribution ~ x^n. More...
 
template<typename T >
int smash::random::poisson (const T &lam)
 Returns a Poisson distributed random number. More...
 
template<typename T >
int smash::random::binomial (const int N, const T &p)
 Returns a binomially distributed random number. More...
 
template<typename T >
double smash::random::normal (const T &mean, const T &sigma)
 Returns a random number drawn from a normal distribution. More...
 
template<typename T = double>
smash::random::cauchy (T pole, T width, T min, T max)
 Draws a random number from a Cauchy distribution (sometimes also called Lorentz or non-relativistic Breit-Wigner distribution) with the given parameters (constant width!) inside the range [min,max]. More...
 
template<typename T = double>
smash::random::beta (T a, T b)
 Draws a random number from a beta-distribution, where probability density of \(x\) is \(p(x) = frac{\Gamma(a)\Gamma(b)}{Gamma(a+b)} x^{a-1} (1-x)^{b-1}\). More...
 
template<typename T = double>
smash::random::beta_a0 (T xmin, T b)
 Draws a random number from a beta-distribution with a = 0. More...
 

Variables

Engine smash::random::engine
 The engine that is used commonly by all distributions. More...