yat  0.21pre
Public Types | Public Member Functions | Protected Attributes | List of all members
theplu::yat::random::Gaussian Class Reference

Gaussian distribution. More...

#include <yat/random/random.h>

Inheritance diagram for theplu::yat::random::Gaussian:
theplu::yat::random::Continuous

Public Types

typedef double result_type
 

Public Member Functions

 Gaussian (const double s=1, const double m=0)
 Constructor. More...
 
double operator() (void) const
 
double operator() (const double s) const
 
double operator() (const double s, const double m) const
 
void seed (unsigned long s) const
 Set the seed to s. More...
 
unsigned long seed_from_devurandom (void)
 Set the seed using the /dev/urandom device. More...
 

Protected Attributes

RNGrng_
 pointer to GSL random generator
 

Detailed Description

Gaussian distribution.

Class for generating a random number from a Gaussian distribution between zero and unity. Utilizes the Box-Muller algorithm, which needs two calls to random generator.

Distribution function $ f(x) = \frac{1}{\sqrt{2\pi\sigma^2}}\exp(-\frac{(x-\mu)^2}{2\sigma^2}) $
Expectation value: $ \mu $
Variance: $ \sigma^2 $

Member Typedef Documentation

◆ result_type

type returned by operator()

Since
New in yat 0.10

Constructor & Destructor Documentation

◆ Gaussian()

theplu::yat::random::Gaussian::Gaussian ( const double  s = 1,
const double  m = 0 
)
explicit

Constructor.

Parameters
sis the standard deviation $ \sigma $ of distribution
mis the expectation value $ \mu $ of the distribution

Member Function Documentation

◆ operator()() [1/3]

double theplu::yat::random::Gaussian::operator() ( void  ) const
virtual
Returns
A random Gaussian number

Implements theplu::yat::random::Continuous.

◆ operator()() [2/3]

double theplu::yat::random::Gaussian::operator() ( const double  s) const
Returns
A random Gaussian number with standard deviation s and expectation value 0.
Note
this operator ignores parameters given in Constructor

◆ operator()() [3/3]

double theplu::yat::random::Gaussian::operator() ( const double  s,
const double  m 
) const
Returns
A random Gaussian number with standard deviation s and expectation value m.
Note
this operator ignores parameters given in Constructor

◆ seed()

void theplu::yat::random::Continuous::seed ( unsigned long  s) const
inherited

Set the seed to s.

Set the seed to s in the underlying rng. If s is zero, a default value from the rng's original implementation is used (cf. GSL documentation).

Deprecated:
Provided for backward compatibility with the 0.7 API. Use RNG::instance()->seed(s) instead.

◆ seed_from_devurandom()

unsigned long theplu::yat::random::Continuous::seed_from_devurandom ( void  )
inherited

Set the seed using the /dev/urandom device.

Returns
The seed acquired from /dev/urandom.
Deprecated:
Provided for backward compatibility with the 0.7 API. Use RNG::instance()->seed_from_devurandom() instead.

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

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14