 ROOT   6.19/01 Reference Guide ROOT::Math::RandomFunctionsImpl< TRandomEngine > Class Template Reference

### template<> class ROOT::Math::RandomFunctionsImpl< TRandomEngine >

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 69 of file RandomFunctions.h.

## Public Member Functions

RandomFunctionsImpl ()
class constructor More...

int Binomial (int ntot, double prob)
Generate binomial numbers. More...

double BreitWigner (double mean, double gamma)
Return a number distributed following a BreitWigner function with mean and gamma. More...

void Circle (double &x, double &y, double r)
Generates random vectors, uniformly distributed over a circle of given radius. More...

double Exp (double tau)
Returns an exponential deviate. More...

double GausACR (double mean, double sigma)
generate random numbers according to the Accemptance-Complemet-Ratio method More...

double GausBM (double mean, double sigma)
generate Gaussian number using Box-Muller method More...

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 ) More...

int Poisson (double mean)
Generates a random integer N according to a Poisson law. More...

double PoissonD (double mean)
Generates a random number according to a Poisson law. More...

void Rannor (double &a, double &b)
Generate numbers distributed following a gaussian with mean=0 and sigma=1. More...

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. More...

double Uniform (double a, double b)
generate random numbers following a Uniform distribution in the [a,b] interval More...

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

## Protected Attributes

TRandomEnginefBaseEngine

## Private Member Functions

double Gaus (double mean, double sigma)

double Rndm ()

#include <Math/RandomFunctions.h>

## ◆ RandomFunctionsImpl()

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

class constructor

Definition at line 74 of file RandomFunctions.h.

## ◆ 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()

 void ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Circle ( double & x, double & y, double r )

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()

 Double_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Exp ( double tau )

Returns an exponential deviate.

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 132 of file RandomFunctions.h.

## ◆ GausACR()

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

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

Definition at line 96 of file RandomFunctions.cxx.

## ◆ GausBM()

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

generate Gaussian number using Box-Muller method

Definition at line 77 of file RandomFunctions.cxx.

## ◆ Landau()

 Double_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::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 )

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()

 Int_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Poisson ( double mean )

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()

 Double_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::PoissonD ( double mean )

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()

 void ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Rannor ( double & a, double & b )

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()

 double ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Rndm ( )
inlineprivate

Definition at line 130 of file RandomFunctions.h.

## ◆ SetEngine()

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

Definition at line 76 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]

 double ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Uniform ( double a, double b )

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.

## ◆ Uniform() [2/2]

 Double_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Uniform ( double a )

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

Definition at line 350 of file RandomFunctions.cxx.

## ◆ fBaseEngine

 TRandomEngine* ROOT::Math::RandomFunctionsImpl< TRandomEngine >::fBaseEngine
protected

Definition at line 126 of file RandomFunctions.h.

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