Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine > Class Template Reference

template<class EngineType>
class ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >

Specialized implementation of the Random functions based on the GSL library.

These will work onlmy with a GSLRandomEngine type

Definition at line 43 of file GSLRandomFunctions.h.

Public Member Functions

 RandomFunctions ()
 
 RandomFunctions (EngineType &rng)
 
 RandomFunctions (EngineType &rng)
 
 ~RandomFunctions ()
 destructor (no op) we do not maintain the engine)
 
double Beta (double a, double b)
 Beta distribution.
 
double Beta (double, double)
 
int Binomial (int ntot, double prob)
 Generate binomial numbers.
 
unsigned int Binomial (unsigned int ntot, double prob)
 Binomial distribution.
 
double BreitWigner (double mean, double gamma)
 Return a number distributed following a BreitWigner function with mean and gamma.
 
double BreitWigner (double mean=0., double gamma=1)
 Breit Wigner distribution.
 
double ChiSquare (double nu)
 Chi square distribution.
 
double ChiSquare (double)
 
void Circle (double &x, double &y, double r)
 Generates random vectors, uniformly distributed over a circle of given radius.
 
void Circle (double &x, double &y, double r=1)
 generate random numbers in a 2D circle of radious 1
 
EngineType & Engine ()
 
double Exp (double tau)
 Returns an exponential deviate.
 
double Exp (double tau)
 Exponential distribution.
 
double FDist (double nu1, double nu2)
 F distribution.
 
double FDist (double, double)
 
double Gamma (double a, double b)
 Gamma distribution.
 
double Gamma (double, double)
 methods which are only for GSL random generators
 
double Gaus (double mean, double sigma)
 generate Gaussian number using default method
 
double Gaus (double mean=0, double sigma=1)
 Gaussian distribution.
 
double GausACR (double mean, double sigma)
 generate random numbers according to the Acceptance-Complement-Ratio method
 
double GausBM (double mean, double sigma)
 generate Gaussian number using Box-Muller method
 
double GausBM (double mean=0, double sigma=1)
 Gaussian distribution (Box-Muller method)
 
double GausR (double mean=0, double sigma=1)
 Gaussian distribution (Ratio Method)
 
void Gaussian2D (double sigmaX, double sigmaY, double rho, double &x, double &y)
 Bivariate Gaussian distribution with correlation.
 
void GaussianND (size_t n, const double *meanVec, const double *covMatrix, double *x, double *lmat=nullptr)
 Multi-variate Gaussian distribution with correlation.
 
double GaussianTail (double a, double sigma=1)
 Gaussian Tail distribution.
 
double GausZig (double mean, double sigma)
 
double Landau (double mean=0, double sigma=1)
 Landau distribution.
 
double Landau (double mu, double sigma)
 Generate a random number following a Landau distribution with location parameter mu and scale parameter sigma: Landau( (x-mu)/sigma )
 
double Logistic (double a)
 Logistic distribution.
 
double Logistic (double)
 
double LogNormal (double zeta, double sigma)
 Log Normal distribution.
 
double LogNormal (double, double)
 
std::vector< unsigned int > MultiNomial (unsigned int, const std::vector< double > &)
 
std::vector< unsigned int > Multinomial (unsigned int ntot, const std::vector< double > &p)
 Multinomial distribution.
 
unsigned int NegativeBinomial (double n, double prob)
 Negative Binomial distribution First parameter is n, second is probability To be consistent with Random::Binomial.
 
unsigned int NegativeBinomial (double, double)
 
double operator() ()
 non-virtual method
 
double Pareto (double a, double b)
 Pareto distribution.
 
double Pareto (double, double)
 
int Poisson (double mean)
 Generates a random integer N according to a Poisson law.
 
unsigned int Poisson (double mu)
 Poisson distribution.
 
double PoissonD (double mean)
 
void Rannor (double &a, double &b)
 Generate numbers distributed following a gaussian with mean=0 and sigma=1.
 
double Rayleigh (double sigma)
 Rayleigh distribution.
 
double Rayleigh (double)
 
void Sphere (double &x, double &y, double &z, double r)
 Generates random vectors, uniformly distributed over the surface of a sphere of given radius.
 
void Sphere (double &x, double &y, double &z, double r=1)
 generate random numbers in a 3D sphere of radious 1
 
double tDist (double nu)
 t student distribution
 
double tDist (double)
 
double Uniform (double a)
 generate random numbers following a Uniform distribution in the [0,a] interval
 
double Uniform (double a, double b)
 generate random numbers following a Uniform distribution in the [a,b] interval
 
- Public Member Functions inherited from ROOT::Math::RandomFunctions< EngineType, DefaultEngineType >
 RandomFunctions (EngineType &rng)
 
 ~RandomFunctions ()
 destructor (no op) we do not maintain the engine)
 
double Beta (double, double)
 
int Binomial (int ntot, double prob)
 Generate binomial numbers.
 
double BreitWigner (double mean, double gamma)
 Return a number distributed following a BreitWigner function with mean and gamma.
 
double ChiSquare (double)
 
void Circle (double &x, double &y, double r)
 Generates random vectors, uniformly distributed over a circle of given radius.
 
double Exp (double tau)
 Returns an exponential deviate.
 
double FDist (double, double)
 
double Gamma (double, double)
 methods which are only for GSL random generators
 
double Gaus (double mean, double sigma)
 generate Gaussian number using default method
 
double GausACR (double mean, double sigma)
 generate random numbers according to the Acceptance-Complement-Ratio method
 
double GausBM (double mean, double sigma)
 generate Gaussian number using Box-Muller method
 
double Landau (double mu, double sigma)
 Generate a random number following a Landau distribution with location parameter mu and scale parameter sigma: Landau( (x-mu)/sigma )
 
double Logistic (double)
 
double LogNormal (double, double)
 
std::vector< unsigned int > MultiNomial (unsigned int, const std::vector< double > &)
 
unsigned int NegativeBinomial (double, double)
 
double operator() ()
 non-virtual method
 
double Pareto (double, double)
 
int Poisson (double mean)
 Generates a random integer N according to a Poisson law.
 
double PoissonD (double mean)
 
void Rannor (double &a, double &b)
 Generate numbers distributed following a gaussian with mean=0 and sigma=1.
 
double Rayleigh (double)
 
void Sphere (double &x, double &y, double &z, double r)
 Generates random vectors, uniformly distributed over the surface of a sphere of given radius.
 
double tDist (double)
 
double Uniform (double a)
 generate random numbers following a Uniform distribution in the [0,a] interval
 
double Uniform (double a, double b)
 generate random numbers following a Uniform distribution in the [a,b] interval
 

Protected Member Functions

double Rndm_impl ()
 Internal implementation to return random number Since this one is not a virtual function is faster than Rndm.
 
EngineType & Rng ()
 
- Protected Member Functions inherited from ROOT::Math::RandomFunctions< EngineType, DefaultEngineType >
double Rndm_impl ()
 Internal implementation to return random number Since this one is not a virtual function is faster than Rndm.
 
EngineType & Rng ()
 

Private Attributes

EngineType * fEngine
 
RandomFunctionsImpl< ROOT::Math::GSLRandomEngine > fImpl
 random number generator engine
 

#include <Math/GSLRandomFunctions.h>

Inheritance diagram for ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >:
[legend]

Constructor & Destructor Documentation

◆ RandomFunctions() [1/3]

template<class EngineType>
ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::RandomFunctions ( )
inline

Definition at line 50 of file GSLRandomFunctions.h.

◆ RandomFunctions() [2/3]

template<class EngineType>
ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::RandomFunctions ( EngineType & rng)
inline

Definition at line 52 of file GSLRandomFunctions.h.

◆ RandomFunctions() [3/3]

ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::RandomFunctions ( EngineType & rng)
inline

Definition at line 147 of file RandomFunctions.h.

◆ ~RandomFunctions()

destructor (no op) we do not maintain the engine)

Definition at line 152 of file RandomFunctions.h.

Member Function Documentation

◆ Beta() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Beta ( double a,
double b )
inline

Beta distribution.

Definition at line 141 of file GSLRandomFunctions.h.

◆ Beta() [2/2]

Definition at line 253 of file RandomFunctions.h.

◆ Binomial() [1/2]

int ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Binomial ( int ntot,
double prob )
inline

Generate binomial numbers.

Definition at line 160 of file RandomFunctions.h.

◆ Binomial() [2/2]

template<class EngineType>
unsigned int ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Binomial ( unsigned int ntot,
double prob )
inline

Binomial distribution.

Definition at line 222 of file GSLRandomFunctions.h.

◆ BreitWigner() [1/2]

double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::BreitWigner ( double mean,
double gamma )
inline

Return a number distributed following a BreitWigner function with mean and gamma.

Definition at line 165 of file RandomFunctions.h.

◆ BreitWigner() [2/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::BreitWigner ( double mean = 0.,
double gamma = 1 )
inline

Breit Wigner distribution.

Definition at line 120 of file GSLRandomFunctions.h.

◆ ChiSquare() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::ChiSquare ( double nu)
inline

Chi square distribution.

Definition at line 155 of file GSLRandomFunctions.h.

◆ ChiSquare() [2/2]

Definition at line 261 of file RandomFunctions.h.

◆ Circle() [1/2]

void ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Circle ( double & x,
double & y,
double r )
inline

Generates random vectors, uniformly distributed over a circle of given radius.

Input : r = circle radius Output: x,y a random 2-d vector of length r

Definition at line 172 of file RandomFunctions.h.

◆ Circle() [2/2]

template<class EngineType>
void ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Circle ( double & x,
double & y,
double r = 1 )
inline

generate random numbers in a 2D circle of radious 1

Definition at line 196 of file GSLRandomFunctions.h.

◆ Engine()

template<class EngineType>
EngineType & ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Engine ( )
inline

Definition at line 55 of file GSLRandomFunctions.h.

◆ Exp() [1/2]

Returns an exponential deviate.

exp( -t/tau )

Definition at line 178 of file RandomFunctions.h.

◆ Exp() [2/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Exp ( double tau)
inline

Exponential distribution.

Definition at line 114 of file GSLRandomFunctions.h.

◆ FDist() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::FDist ( double nu1,
double nu2 )
inline

F distribution.

Definition at line 162 of file GSLRandomFunctions.h.

◆ FDist() [2/2]

Definition at line 277 of file RandomFunctions.h.

◆ Gamma() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Gamma ( double a,
double b )
inline

Gamma distribution.

Definition at line 134 of file GSLRandomFunctions.h.

◆ Gamma() [2/2]

methods which are only for GSL random generators

Gamma functions (not implemented here, requires a GSL random engine)

Definition at line 248 of file RandomFunctions.h.

◆ Gaus() [1/2]

double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Gaus ( double mean,
double sigma )
inline

generate Gaussian number using default method

Definition at line 228 of file RandomFunctions.h.

◆ Gaus() [2/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Gaus ( double mean = 0,
double sigma = 1 )
inline

Gaussian distribution.

Default method (use Ziggurat)

Definition at line 68 of file GSLRandomFunctions.h.

◆ GausACR()

double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::GausACR ( double mean,
double sigma )
inline

generate random numbers according to the Acceptance-Complement-Ratio method

Definition at line 188 of file RandomFunctions.h.

◆ GausBM() [1/2]

double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::GausBM ( double mean,
double sigma )
inline

generate Gaussian number using Box-Muller method

Definition at line 183 of file RandomFunctions.h.

◆ GausBM() [2/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::GausBM ( double mean = 0,
double sigma = 1 )
inline

Gaussian distribution (Box-Muller method)

Definition at line 75 of file GSLRandomFunctions.h.

◆ GausR()

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::GausR ( double mean = 0,
double sigma = 1 )
inline

Gaussian distribution (Ratio Method)

Definition at line 82 of file GSLRandomFunctions.h.

◆ Gaussian2D()

template<class EngineType>
void ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Gaussian2D ( double sigmaX,
double sigmaY,
double rho,
double & x,
double & y )
inline

Bivariate Gaussian distribution with correlation.

Definition at line 96 of file GSLRandomFunctions.h.

◆ GaussianND()

template<class EngineType>
void ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::GaussianND ( size_t n,
const double * meanVec,
const double * covMatrix,
double * x,
double * lmat = nullptr )
inline

Multi-variate Gaussian distribution with correlation.

The covMatrix is a pointer to the covcariance matrix (NxN) Lmat is a pointer to store the factorized Cholesky decomposition C = LL^T of the covariance matrix If the generator is to be called again with the same covariance one can provide a null CovMAtrix and only lmat

Definition at line 107 of file GSLRandomFunctions.h.

◆ GaussianTail()

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::GaussianTail ( double a,
double sigma = 1 )
inline

Gaussian Tail distribution.

Definition at line 89 of file GSLRandomFunctions.h.

◆ GausZig()

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::GausZig ( double mean,
double sigma )
inline

Definition at line 57 of file GSLRandomFunctions.h.

◆ Landau() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Landau ( double mean = 0,
double sigma = 1 )
inline

Landau distribution.

Definition at line 127 of file GSLRandomFunctions.h.

◆ Landau() [2/2]

double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Landau ( double mu,
double sigma )
inline

Generate a random number following a Landau distribution with location parameter mu and scale parameter sigma: Landau( (x-mu)/sigma )

Definition at line 195 of file RandomFunctions.h.

◆ Logistic() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Logistic ( double a)
inline

Logistic distribution.

Definition at line 182 of file GSLRandomFunctions.h.

◆ Logistic() [2/2]

Definition at line 269 of file RandomFunctions.h.

◆ LogNormal() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::LogNormal ( double zeta,
double sigma )
inline

Log Normal distribution.

Definition at line 148 of file GSLRandomFunctions.h.

◆ LogNormal() [2/2]

Definition at line 257 of file RandomFunctions.h.

◆ MultiNomial()

std::vector< unsigned int > ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::MultiNomial ( unsigned int ,
const std::vector< double > &  )
inline

Definition at line 289 of file RandomFunctions.h.

◆ Multinomial()

template<class EngineType>
std::vector< unsigned int > ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Multinomial ( unsigned int ntot,
const std::vector< double > & p )
inline

Multinomial distribution.

Definition at line 238 of file GSLRandomFunctions.h.

◆ NegativeBinomial() [1/2]

template<class EngineType>
unsigned int ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::NegativeBinomial ( double n,
double prob )
inline

Negative Binomial distribution First parameter is n, second is probability To be consistent with Random::Binomial.

Definition at line 231 of file GSLRandomFunctions.h.

◆ NegativeBinomial() [2/2]

unsigned int ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::NegativeBinomial ( double ,
double  )
inline

Definition at line 285 of file RandomFunctions.h.

◆ operator()()

double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::operator() ( )
inline

non-virtual method

Definition at line 156 of file RandomFunctions.h.

◆ Pareto() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Pareto ( double a,
double b )
inline

Pareto distribution.

Definition at line 189 of file GSLRandomFunctions.h.

◆ Pareto() [2/2]

Definition at line 273 of file RandomFunctions.h.

◆ Poisson() [1/2]

int ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Poisson ( double mean)
inline

Generates a random integer N according to a Poisson law.

Prob(N) = exp(-mean)*mean^N/Factorial(N)

Definition at line 201 of file RandomFunctions.h.

◆ Poisson() [2/2]

template<class EngineType>
unsigned int ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Poisson ( double mu)
inline

Poisson distribution.

Definition at line 215 of file GSLRandomFunctions.h.

◆ PoissonD()

double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::PoissonD ( double mean)
inline

Definition at line 202 of file RandomFunctions.h.

◆ Rannor()

void ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Rannor ( double & a,
double & b )
inline

Generate numbers distributed following a gaussian with mean=0 and sigma=1.

Using the Box-Muller method

Definition at line 206 of file RandomFunctions.h.

◆ Rayleigh() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Rayleigh ( double sigma)
inline

Rayleigh distribution.

Definition at line 175 of file GSLRandomFunctions.h.

◆ Rayleigh() [2/2]

Definition at line 265 of file RandomFunctions.h.

◆ Rndm_impl()

double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Rndm_impl ( )
inlineprotected

Internal implementation to return random number Since this one is not a virtual function is faster than Rndm.

Definition at line 301 of file RandomFunctions.h.

◆ Rng()

EngineType & ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Rng ( )
inlineprotected

Definition at line 297 of file RandomFunctions.h.

◆ Sphere() [1/2]

void ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Sphere ( double & x,
double & y,
double & z,
double r )
inline

Generates random vectors, uniformly distributed over the surface of a sphere of given radius.

Definition at line 212 of file RandomFunctions.h.

◆ Sphere() [2/2]

template<class EngineType>
void ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::Sphere ( double & x,
double & y,
double & z,
double r = 1 )
inline

generate random numbers in a 3D sphere of radious 1

Definition at line 205 of file GSLRandomFunctions.h.

◆ tDist() [1/2]

template<class EngineType>
double ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::tDist ( double nu)
inline

t student distribution

Definition at line 169 of file GSLRandomFunctions.h.

◆ tDist() [2/2]

Definition at line 281 of file RandomFunctions.h.

◆ Uniform() [1/2]

generate random numbers following a Uniform distribution in the [0,a] interval

Definition at line 222 of file RandomFunctions.h.

◆ Uniform() [2/2]

generate random numbers following a Uniform distribution in the [a,b] interval

Definition at line 217 of file RandomFunctions.h.

Member Data Documentation

◆ fEngine

EngineType* ROOT::Math::RandomFunctions< EngineType, ROOT::Math::GSLRandomEngine >::fEngine
private

Definition at line 306 of file RandomFunctions.h.

◆ fImpl

random number generator engine

Definition at line 307 of file RandomFunctions.h.

  • math/mathmore/inc/Math/GSLRandomFunctions.h