BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::RandomFunctionsImpl< TRandomEngine > Class Reference

Description

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.

Collaboration diagram for ROOT::Math::RandomFunctionsImpl< TRandomEngine >:
[legend]

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. Input : r = circle radius Output: x,y a random 2-d vector of length r. More...
 
double Exp (double tau)
 Returns an exponential deviate. exp( -t/tau ) 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...
 
int Poisson (double mean)
 Generate a random number following a Landau distribution with location parameter mu and scale parameter sigma: Landau( (x-mu)/sigma ) More...
 
double PoissonD (double mean)
 
void Rannor (double &a, double &b)
 Generate numbers distributed following a gaussian with mean=0 and sigma=1. Using the Box-Muller method. 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 Uniform (double a, double b)
 generate random numbers following a Uniform distribution in the [a,b] interval More...
 

Protected Attributes

TRandomEnginefBaseEngine
 

Private Member Functions

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

Constructor & Destructor Documentation

◆ RandomFunctionsImpl()

class constructor

Definition at line 74 of file RandomFunctions.h.

Member Function Documentation

◆ Binomial()

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

Generate binomial numbers.

◆ BreitWigner()

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

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

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

◆ Exp()

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

Returns an exponential deviate. exp( -t/tau )

◆ Gaus()

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

Definition at line 132 of file RandomFunctions.h.

132 { return GausACR(mean,sigma); }
double GausACR(double mean, double sigma)
generate random numbers according to the Accemptance-Complemet-Ratio method

◆ GausACR()

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

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

◆ GausBM()

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

generate Gaussian number using Box-Muller method

◆ Poisson()

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

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

Generates a random integer N according to a Poisson law. Prob(N) = exp(-mean)*mean^N/Factorial(N)

◆ PoissonD()

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

◆ Rannor()

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

Generate numbers distributed following a gaussian with mean=0 and sigma=1. Using the Box-Muller method.

◆ Rndm()

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

Definition at line 130 of file RandomFunctions.h.

130 { return fBaseEngine->Rndm(); }
virtual double Rndm()=0

References ROOT::Math::TRandomEngine::Rndm().

Here is the call graph for this function:

◆ SetEngine()

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

Definition at line 76 of file RandomFunctions.h.

76  {
77  fBaseEngine = static_cast<TRandomEngine*>(r);
78  assert(fBaseEngine); // to be sure the static cast works
79  }

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

◆ Uniform() [1/2]

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

◆ Uniform() [2/2]

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

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

Member Data Documentation

◆ fBaseEngine

Definition at line 126 of file RandomFunctions.h.


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