ROOT logo
ROOT » MATH » MATHMORE » ROOT::Math::GSLRandomEngine

class ROOT::Math::GSLRandomEngine


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

      The main GSL generators (see
      <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Random-number-generator-algorithms.html">
      here</A>) 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
      <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Random-Number-Distributions.html">
      GSL random number distributions</A>.



      @ingroup Random

Function Members (Methods)

public:
virtual~GSLRandomEngine()
unsigned intBinomial(double p, unsigned int n) const
doubleCauchy(double a) const
doubleChiSquare(double nu) const
voidDir2D(double& x, double& y) const
voidDir3D(double& x, double& y, double& z) const
doubleExponential(double mu) const
doubleFDist(double nu1, double nu2) const
doubleGamma(double a, double b) const
doubleGaussian(double sigma) const
voidGaussian2D(double sigmaX, double sigmaY, double rho, double& x, double& y) const
doubleGaussianRatio(double sigma) const
doubleGaussianTail(double a, double sigma) const
doubleGaussianZig(double sigma) const
ROOT::Math::GSLRandomEngineGSLRandomEngine()
ROOT::Math::GSLRandomEngineGSLRandomEngine(ROOT::Math::GSLRngWrapper* rng)
ROOT::Math::GSLRandomEngineGSLRandomEngine(const ROOT::Math::GSLRandomEngine&)
voidInitialize()
doubleLandau() const
doubleLogNormal(double zeta, double sigma) const
vector<unsigned int>Multinomial(unsigned int ntot, const vector<double>& p) const
stringName() const
unsigned intNegativeBinomial(double p, double n) const
doubleoperator()() const
ROOT::Math::GSLRandomEngine&operator=(const ROOT::Math::GSLRandomEngine&)
unsigned intPoisson(double mu) const
voidRandomArray(double* begin, double* end) const
unsigned intRndmInt(unsigned int max) const
voidSetSeed(unsigned int seed) const
unsigned intSize() const
doubletDist(double nu) const
voidTerminate()
protected:
voidSetType(ROOT::Math::GSLRngWrapper* r)

Data Members

private:
unsigned intfCurTimecurrent time used to seed the generator
ROOT::Math::GSLRngWrapper*fRngpointer to GSL generator wrapper (managed by the class)

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

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

GSLRandomEngine( GSLRngWrapper * rng)
          create from an existing rng.
          User manage the rng pointer which is then deleted olny by calling Terminate()

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

void Terminate()
         delete pointer to contained rng

virtual ~GSLRandomEngine()
         call Terminate()

double operator()() const
         Generate a  random number between ]0,1]
         0 is excluded and 1 is included

unsigned int RndmInt(unsigned int 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

void RandomArray(double* begin, double* end) const
         Generate an array of random numbers.
         The iterators points to the random numbers

std::string Name() const
         return name of generator

unsigned int Size() const
         return the state size of generator

void SetSeed(unsigned int seed) const
          set the random generator seed

double Gaussian(double sigma) const
 @name Random Distributions
          Implemented using the
          <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Random-Number-Distributions.html">
          GSL Random number Distributions</A>

@{

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

double GaussianZig(double sigma) const
         Gaussian distribution - Ziggurat method

double GaussianRatio(double sigma) const
         Gaussian distribution - Ratio method

double GaussianTail(double a, double sigma) const
         Gaussian Tail distribution

void Gaussian2D(double sigmaX, double sigmaY, double rho, double& x, double& y) const
         Bivariate Gaussian distribution with correlation

double Exponential(double mu) const
         Exponential distribution

double Cauchy(double a) const
         Cauchy distribution

double Landau() const
         Landau distribution

double Gamma(double a, double b) const
         Gamma distribution

double LogNormal(double zeta, double sigma) const
         Log Normal distribution

double ChiSquare(double nu) const
         Chi square distribution

double FDist(double nu1, double nu2) const
         F distrbution

double tDist(double nu) const
         t student distribution

void Dir2D(double& x, double& y) const
         generate random numbers in a 2D circle of radious 1

void Dir3D(double& x, double& y, double& z) const
         generate random numbers in a 3D sphere of radious 1

unsigned int Poisson(double mu) const
         Poisson distribution

unsigned int Binomial(double p, unsigned int n) const
         Binomial distribution

unsigned int NegativeBinomial(double p, double n) const
         Negative Binomial distribution

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

void SetType(ROOT::Math::GSLRngWrapper* r)
@}
 internal method used by the derived class to set the type of generators