Logo ROOT  
Reference Guide
ROOT::Math::GSLRandomEngine Class Reference

GSLRandomEngine Base class for all GSL random engines, normally user instantiate the derived classes which creates internally the generator.

The main GSL generators (see here) are available as derived classes In addition to generate uniform numbers it provides method for generating numbers according to pre-defined distributions using the GSL functions from GSL random number distributions.

Definition at line 65 of file GSLRndmEngines.h.

Public Member Functions

 GSLRandomEngine ()
 default constructor. More...
 
 GSLRandomEngine (const GSLRandomEngine &eng)
 Copy constructor : clone the contained GSL generator. More...
 
 GSLRandomEngine (GSLRngWrapper *rng)
 create from an existing rng. More...
 
virtual ~GSLRandomEngine ()
 call Terminate() More...
 
void Initialize ()
 initialize the generator If no rng is present the default one based on Mersenne and Twister is created More...
 
unsigned long IntRndm () const
 Generate an integer number between [0,max_generator-1] (including 0 and max-1) if max is larger than available range of algorithm an error message is printed and zero is returned. More...
 
unsigned long MaxInt () const
 return the maximum integer +1 a generator can handle More...
 
unsigned long MinInt () const
 return the minimum integer a generator can handle typically this value is 0 More...
 
std::string Name () const
 return name of generator More...
 
double operator() () const
 Generate a random number between ]0,1] 0 is excluded and 1 is included. More...
 
GSLRandomEngineoperator= (const GSLRandomEngine &eng)
 Assignment operator : make a deep copy of the contained GSL generator. More...
 
void RandomArray (double *begin, double *end) const
 Generate an array of random numbers The iterators points to the random numbers. More...
 
template<class Iterator >
void RandomArray (Iterator begin, Iterator end) const
 Generate an array of random numbers. More...
 
double Rndm () const
 Generate a random number between ]0,1] 0 is excluded and 1 is included. More...
 
unsigned long RndmInt (unsigned long max) const
 Generate an integer number between [0,max-1] (including 0 and max-1) if max is larger than available range of algorithm an error message is printed and zero is returned. More...
 
void SetSeed (unsigned int seed) const
 set the random generator seed More...
 
unsigned int Size () const
 return the state size of generator More...
 
void Terminate ()
 delete pointer to contained rng More...
 

Friends

class GSLMCIntegrator
 

Random Distributions

Implemented using the GSL Random number Distributions

GSLRngWrapperfRng
 
unsigned int fCurTime
 
double Gaussian (double sigma) const
 Gaussian distribution - default method is Box-Muller (polar method) More...
 
double GaussianZig (double sigma) const
 Gaussian distribution - Ziggurat method. More...
 
double GaussianRatio (double sigma) const
 Gaussian distribution - Ratio method. More...
 
double GaussianTail (double a, double sigma) const
 Gaussian Tail distribution. More...
 
void Gaussian2D (double sigmaX, double sigmaY, double rho, double &x, double &y) const
 Bivariate Gaussian distribution with correlation. More...
 
double Exponential (double mu) const
 Exponential distribution. More...
 
double Cauchy (double a) const
 Cauchy distribution. More...
 
double Landau () const
 Landau distribution. More...
 
double Gamma (double a, double b) const
 Gamma distribution. More...
 
double Beta (double a, double b) const
 Beta distribution. More...
 
double LogNormal (double zeta, double sigma) const
 Log Normal distribution. More...
 
double ChiSquare (double nu) const
 Chi square distribution. More...
 
double FDist (double nu1, double nu2) const
 F distrbution. More...
 
double tDist (double nu) const
 t student distribution More...
 
double Rayleigh (double sigma) const
 Rayleigh distribution. More...
 
double Logistic (double a) const
 Logistic distribution. More...
 
double Pareto (double a, double b) const
 Pareto distribution. More...
 
void Dir2D (double &x, double &y) const
 generate random numbers in a 2D circle of radious 1 More...
 
void Dir3D (double &x, double &y, double &z) const
 generate random numbers in a 3D sphere of radious 1 More...
 
unsigned int Poisson (double mu) const
 Poisson distribution. More...
 
unsigned int Binomial (double p, unsigned int n) const
 Binomial distribution. More...
 
unsigned int NegativeBinomial (double p, double n) const
 Negative Binomial distribution. More...
 
std::vector< unsigned int > Multinomial (unsigned int ntot, const std::vector< double > &p) const
 Multinomial distribution. More...
 
void SetType (GSLRngWrapper *r)
 internal method used by the derived class to set the type of generators More...
 
GSLRngWrapperEngine ()
 internal method to return the engine Used by class like GSLMCIntegrator to set the engine More...
 

#include <Math/GSLRndmEngines.h>

Inheritance diagram for ROOT::Math::GSLRandomEngine:
[legend]

Constructor & Destructor Documentation

◆ GSLRandomEngine() [1/3]

ROOT::Math::GSLRandomEngine::GSLRandomEngine ( )

default constructor.

No creation of rng is done. If then Initialize() is called an engine is created based on default GSL type (MT)

Definition at line 59 of file GSLRndmEngines.cxx.

◆ GSLRandomEngine() [2/3]

ROOT::Math::GSLRandomEngine::GSLRandomEngine ( GSLRngWrapper rng)

create from an existing rng.

User manage the rng pointer which is then deleted olny by calling Terminate()

Definition at line 67 of file GSLRndmEngines.cxx.

◆ GSLRandomEngine() [3/3]

ROOT::Math::GSLRandomEngine::GSLRandomEngine ( const GSLRandomEngine eng)

Copy constructor : clone the contained GSL generator.

Definition at line 73 of file GSLRndmEngines.cxx.

◆ ~GSLRandomEngine()

ROOT::Math::GSLRandomEngine::~GSLRandomEngine ( )
virtual

call Terminate()

Definition at line 78 of file GSLRndmEngines.cxx.

Member Function Documentation

◆ Beta()

double ROOT::Math::GSLRandomEngine::Beta ( double  a,
double  b 
) const

Beta distribution.

Definition at line 230 of file GSLRndmEngines.cxx.

◆ Binomial()

unsigned int ROOT::Math::GSLRandomEngine::Binomial ( double  p,
unsigned int  n 
) const

Binomial distribution.

Definition at line 303 of file GSLRndmEngines.cxx.

◆ Cauchy()

double ROOT::Math::GSLRandomEngine::Cauchy ( double  a) const

Cauchy distribution.

Definition at line 218 of file GSLRndmEngines.cxx.

◆ ChiSquare()

double ROOT::Math::GSLRandomEngine::ChiSquare ( double  nu) const

Chi square distribution.

Definition at line 248 of file GSLRndmEngines.cxx.

◆ Dir2D()

void ROOT::Math::GSLRandomEngine::Dir2D ( double &  x,
double &  y 
) const

generate random numbers in a 2D circle of radious 1

Definition at line 285 of file GSLRndmEngines.cxx.

◆ Dir3D()

void ROOT::Math::GSLRandomEngine::Dir3D ( double &  x,
double &  y,
double &  z 
) const

generate random numbers in a 3D sphere of radious 1

Definition at line 291 of file GSLRndmEngines.cxx.

◆ Engine()

GSLRngWrapper * ROOT::Math::GSLRandomEngine::Engine ( )
inlineprotected

internal method to return the engine Used by class like GSLMCIntegrator to set the engine

Definition at line 315 of file GSLRndmEngines.h.

◆ Exponential()

double ROOT::Math::GSLRandomEngine::Exponential ( double  mu) const

Exponential distribution.

Definition at line 212 of file GSLRndmEngines.cxx.

◆ FDist()

double ROOT::Math::GSLRandomEngine::FDist ( double  nu1,
double  nu2 
) const

F distrbution.

Definition at line 255 of file GSLRndmEngines.cxx.

◆ Gamma()

double ROOT::Math::GSLRandomEngine::Gamma ( double  a,
double  b 
) const

Gamma distribution.

Definition at line 236 of file GSLRndmEngines.cxx.

◆ Gaussian()

double ROOT::Math::GSLRandomEngine::Gaussian ( double  sigma) const

Gaussian distribution - default method is Box-Muller (polar method)

Definition at line 186 of file GSLRndmEngines.cxx.

◆ Gaussian2D()

void ROOT::Math::GSLRandomEngine::Gaussian2D ( double  sigmaX,
double  sigmaY,
double  rho,
double &  x,
double &  y 
) const

Bivariate Gaussian distribution with correlation.

Definition at line 206 of file GSLRndmEngines.cxx.

◆ GaussianRatio()

double ROOT::Math::GSLRandomEngine::GaussianRatio ( double  sigma) const

Gaussian distribution - Ratio method.

Definition at line 192 of file GSLRndmEngines.cxx.

◆ GaussianTail()

double ROOT::Math::GSLRandomEngine::GaussianTail ( double  a,
double  sigma 
) const

Gaussian Tail distribution.

Definition at line 199 of file GSLRndmEngines.cxx.

◆ GaussianZig()

double ROOT::Math::GSLRandomEngine::GaussianZig ( double  sigma) const

Gaussian distribution - Ziggurat method.

Definition at line 180 of file GSLRndmEngines.cxx.

◆ Initialize()

void ROOT::Math::GSLRandomEngine::Initialize ( )

initialize the generator If no rng is present the default one based on Mersenne and Twister is created

Definition at line 95 of file GSLRndmEngines.cxx.

◆ IntRndm()

unsigned long ROOT::Math::GSLRandomEngine::IntRndm ( ) const
inline

Generate an integer number between [0,max_generator-1] (including 0 and max-1) if max is larger than available range of algorithm an error message is printed and zero is returned.

Definition at line 133 of file GSLRndmEngines.h.

◆ Landau()

double ROOT::Math::GSLRandomEngine::Landau ( ) const

Landau distribution.

Definition at line 224 of file GSLRndmEngines.cxx.

◆ Logistic()

double ROOT::Math::GSLRandomEngine::Logistic ( double  a) const

Logistic distribution.

Definition at line 273 of file GSLRndmEngines.cxx.

◆ LogNormal()

double ROOT::Math::GSLRandomEngine::LogNormal ( double  zeta,
double  sigma 
) const

Log Normal distribution.

Definition at line 242 of file GSLRndmEngines.cxx.

◆ MaxInt()

unsigned long ROOT::Math::GSLRandomEngine::MaxInt ( ) const

return the maximum integer +1 a generator can handle

Definition at line 128 of file GSLRndmEngines.cxx.

◆ MinInt()

unsigned long ROOT::Math::GSLRandomEngine::MinInt ( ) const

return the minimum integer a generator can handle typically this value is 0

Definition at line 123 of file GSLRndmEngines.cxx.

◆ Multinomial()

std::vector< unsigned int > ROOT::Math::GSLRandomEngine::Multinomial ( unsigned int  ntot,
const std::vector< double > &  p 
) const

Multinomial distribution.

Definition at line 316 of file GSLRndmEngines.cxx.

◆ Name()

std::string ROOT::Math::GSLRandomEngine::Name ( ) const

return name of generator

Definition at line 162 of file GSLRndmEngines.cxx.

◆ NegativeBinomial()

unsigned int ROOT::Math::GSLRandomEngine::NegativeBinomial ( double  p,
double  n 
) const

Negative Binomial distribution.

Definition at line 309 of file GSLRndmEngines.cxx.

◆ operator()()

double ROOT::Math::GSLRandomEngine::operator() ( ) const

Generate a random number between ]0,1] 0 is excluded and 1 is included.

Definition at line 111 of file GSLRndmEngines.cxx.

◆ operator=()

GSLRandomEngine & ROOT::Math::GSLRandomEngine::operator= ( const GSLRandomEngine eng)

Assignment operator : make a deep copy of the contained GSL generator.

Definition at line 84 of file GSLRndmEngines.cxx.

◆ Pareto()

double ROOT::Math::GSLRandomEngine::Pareto ( double  a,
double  b 
) const

Pareto distribution.

Definition at line 279 of file GSLRndmEngines.cxx.

◆ Poisson()

unsigned int ROOT::Math::GSLRandomEngine::Poisson ( double  mu) const

Poisson distribution.

Definition at line 297 of file GSLRndmEngines.cxx.

◆ RandomArray() [1/2]

void ROOT::Math::GSLRandomEngine::RandomArray ( double *  begin,
double *  end 
) const

Generate an array of random numbers The iterators points to the random numbers.

Definition at line 133 of file GSLRndmEngines.cxx.

◆ RandomArray() [2/2]

template<class Iterator >
void ROOT::Math::GSLRandomEngine::RandomArray ( Iterator  begin,
Iterator  end 
) const
inline

Generate an array of random numbers.

The iterators points to the random numbers

Definition at line 142 of file GSLRndmEngines.h.

◆ Rayleigh()

double ROOT::Math::GSLRandomEngine::Rayleigh ( double  sigma) const

Rayleigh distribution.

Definition at line 267 of file GSLRndmEngines.cxx.

◆ Rndm()

double ROOT::Math::GSLRandomEngine::Rndm ( ) const
inline

Generate a random number between ]0,1] 0 is excluded and 1 is included.

Definition at line 120 of file GSLRndmEngines.h.

◆ RndmInt()

unsigned long ROOT::Math::GSLRandomEngine::RndmInt ( unsigned long  max) const

Generate an integer number between [0,max-1] (including 0 and max-1) if max is larger than available range of algorithm an error message is printed and zero is returned.

Definition at line 118 of file GSLRndmEngines.cxx.

◆ SetSeed()

void ROOT::Math::GSLRandomEngine::SetSeed ( unsigned int  seed) const

set the random generator seed

Definition at line 141 of file GSLRndmEngines.cxx.

◆ SetType()

void ROOT::Math::GSLRandomEngine::SetType ( GSLRngWrapper r)
inlineprotected

internal method used by the derived class to set the type of generators

Definition at line 309 of file GSLRndmEngines.h.

◆ Size()

unsigned int ROOT::Math::GSLRandomEngine::Size ( ) const

return the state size of generator

Definition at line 170 of file GSLRndmEngines.cxx.

◆ tDist()

double ROOT::Math::GSLRandomEngine::tDist ( double  nu) const

t student distribution

Definition at line 261 of file GSLRndmEngines.cxx.

◆ Terminate()

void ROOT::Math::GSLRandomEngine::Terminate ( void  )

delete pointer to contained rng

Definition at line 102 of file GSLRndmEngines.cxx.

Friends And Related Function Documentation

◆ GSLMCIntegrator

friend class GSLMCIntegrator
friend

Definition at line 67 of file GSLRndmEngines.h.

Member Data Documentation

◆ fCurTime

unsigned int ROOT::Math::GSLRandomEngine::fCurTime
mutableprivate

Definition at line 322 of file GSLRndmEngines.h.

◆ fRng

GSLRngWrapper* ROOT::Math::GSLRandomEngine::fRng
private

Definition at line 321 of file GSLRndmEngines.h.

Libraries for ROOT::Math::GSLRandomEngine:
[legend]

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