Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Math::RandomFunctionsImpl< TRandomEngine > Class Reference

Implementation class for the RandomFunction for all the engined that derives from TRandomEngine class, which defines an interface which has TRandomEngine::Rndm() In this way we can have a common implementation for the RandomFunctions.

Definition at line 70 of file RandomFunctions.h.

Public Member Functions

 RandomFunctionsImpl ()
 class constructor
 
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.
 
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 GausACR (double mean, double sigma)
 generate random numbers according to the Accemptance-Complemet-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 )
 
int Poisson (double mean)
 Generates a random integer N according to a Poisson law.
 
double PoissonD (double mean)
 Generates a random number according to a Poisson law.
 
void Rannor (double &a, double &b)
 Generate numbers distributed following a gaussian with mean=0 and sigma=1.
 
void SetEngine (void *r)
 
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 Uniform (double a)
 Returns a uniform deviate on the interval (0, x1).
 
double Uniform (double a, double b)
 generate random numbers following a Uniform distribution in the [a,b] interval
 

Protected Attributes

TRandomEnginefBaseEngine
 

Private Member Functions

double Gaus (double mean, double sigma)
 
double Rndm ()
 

#include <Math/RandomFunctions.h>

Constructor & Destructor Documentation

◆ RandomFunctionsImpl()

ROOT::Math::RandomFunctionsImpl< TRandomEngine >::RandomFunctionsImpl ( )
inline

class constructor

Definition at line 75 of file RandomFunctions.h.

Member Function Documentation

◆ Binomial()

Int_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Binomial ( int  ntot,
double  prob 
)

Generate binomial numbers.

Definition at line 27 of file RandomFunctions.cxx.

◆ BreitWigner()

Double_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::BreitWigner ( double  mean,
double  gamma 
)

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

Definition at line 41 of file RandomFunctions.cxx.

◆ Circle()

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 55 of file RandomFunctions.cxx.

◆ Exp()

Returns an exponential deviate.

exp( -t/tau )

     exp( -t/tau ) 

Definition at line 67 of file RandomFunctions.cxx.

◆ Gaus()

double ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Gaus ( double  mean,
double  sigma 
)
inlineprivate

Definition at line 133 of file RandomFunctions.h.

◆ GausACR()

generate random numbers according to the Accemptance-Complemet-Ratio method

Definition at line 96 of file RandomFunctions.cxx.

◆ GausBM()

generate Gaussian number using Box-Muller method

Definition at line 77 of file RandomFunctions.cxx.

◆ Landau()

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

Generate a random number following a Landau distribution with location parameter mu and scale parameter sigma: Landau( (x-mu)/sigma ) Note that mu is not the mpv(most probable value) of the Landa distribution and sigma is not the standard deviation of the distribution which is not defined.

For mu =0 and sigma=1, the mpv = -0.22278

The Landau random number generation is implemented using the function landau_quantile(x,sigma), which provides the inverse of the landau cumulative distribution. landau_quantile has been converted from CERNLIB ranlan(G110).

Definition at line 191 of file RandomFunctions.cxx.

◆ Poisson()

Generates a random integer N according to a Poisson law.

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

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

Use a different procedure according to the mean value. The algorithm is the same used by CLHEP. For lower value (mean < 25) use the rejection method based on the exponential. For higher values use a rejection method comparing with a Lorentzian distribution, as suggested by several authors. This routine since is returning 32 bits integer will not work for values larger than 2*10**9. One should then use the Trandom::PoissonD for such large values.

Definition at line 213 of file RandomFunctions.cxx.

◆ PoissonD()

Generates a random number according to a Poisson law.

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

This function is a variant of RandomFunctionsImpl<TRandomEngine>::Poisson returning a double instead of an integer.

Definition at line 265 of file RandomFunctions.cxx.

◆ Rannor()

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

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

Using the Box-Muller method

Definition at line 312 of file RandomFunctions.cxx.

◆ Rndm()

Definition at line 131 of file RandomFunctions.h.

◆ SetEngine()

void ROOT::Math::RandomFunctionsImpl< TRandomEngine >::SetEngine ( void r)
inline

Definition at line 77 of file RandomFunctions.h.

◆ Sphere()

void ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Sphere ( double x,
double y,
double z,
double  r 
)

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

Input : r = sphere radius Output: x,y,z a random 3-d vector of length r Method: (based on algorithm suggested by Knuth and attributed to Robert E Knop) which uses less random numbers than the CERNLIB RN23DIM algorithm

Definition at line 332 of file RandomFunctions.cxx.

◆ Uniform() [1/2]

Returns a uniform deviate on the interval (0, x1).

Definition at line 350 of file RandomFunctions.cxx.

◆ Uniform() [2/2]

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

Returns a uniform deviate on the interval (x1, x2).

Definition at line 359 of file RandomFunctions.cxx.

Member Data Documentation

◆ fBaseEngine

Definition at line 127 of file RandomFunctions.h.

  • math/mathcore/inc/Math/RandomFunctions.h
  • math/mathcore/src/RandomFunctions.cxx