Logo ROOT   6.13/01
Reference Guide
List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
TRandom1 Class Reference

The Ranlux Random number generator class.

The algorithm for this random engine has been taken from the original implementation in FORTRAN by Fred James as part of CLHEP.

The initialisation is carried out using a Multiplicative Congruential generator using formula constants of L'Ecuyer as described in "F.James, Comp. Phys. Comm. 60 (1990) 329-344".

Definition at line 27 of file TRandom1.h.

Public Member Functions

 TRandom1 ()
 default constructor More...
 
 TRandom1 (UInt_t seed, Int_t lux=3)
 Luxury level is set in the same way as the original FORTRAN routine. More...
 
 TRandom1 (Int_t rowIndex, Int_t colIndex, Int_t lux)
 
virtual ~TRandom1 ()
 destructor More...
 
virtual Int_t GetLuxury () const
 
virtual UInt_t GetSeed () const
 
const UInt_t * GetTheSeeds () const
 
virtual Double_t Rndm ()
 return a random number in ]0,1] More...
 
virtual void RndmArray (Int_t size, Float_t *vect)
 return an array of random numbers in ]0,1] More...
 
virtual void RndmArray (Int_t size, Double_t *vect)
 return an array of random numbers in ]0,1[ More...
 
virtual void SetSeed (ULong_t seed)
 Set the random generator seed. More...
 
virtual void SetSeed2 (UInt_t seed, Int_t lux=3)
 The initialisation is carried out using a Multiplicative Congruential generator using formula constants of L'Ecuyer as described in "A review of pseudorandom number generators" (Fred James) published in Computer Physics Communications 60 (1990) pages 329-344. More...
 
virtual void SetSeeds (const UInt_t *seeds, Int_t lux=3)
 set seeds More...
 
- Public Member Functions inherited from TRandom
 TRandom (UInt_t seed=65539)
 Default constructor. For seed see SetSeed(). More...
 
virtual ~TRandom ()
 Default destructor. More...
 
virtual Int_t Binomial (Int_t ntot, Double_t prob)
 Generates a random integer N according to the binomial law. More...
 
virtual Double_t BreitWigner (Double_t mean=0, Double_t gamma=1)
 Return a number distributed following a BreitWigner function with mean and gamma. More...
 
virtual void Circle (Double_t &x, Double_t &y, Double_t r)
 Generates random vectors, uniformly distributed over a circle of given radius. More...
 
virtual Double_t Exp (Double_t tau)
 Returns an exponential deviate. More...
 
virtual Double_t Gaus (Double_t mean=0, Double_t sigma=1)
 Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigma. More...
 
virtual UInt_t Integer (UInt_t imax)
 Returns a random integer on [ 0, imax-1 ]. More...
 
virtual Double_t Landau (Double_t mean=0, Double_t sigma=1)
 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. More...
 
virtual Int_t Poisson (Double_t mean)
 Generates a random integer N according to a Poisson law. More...
 
virtual Double_t PoissonD (Double_t mean)
 Generates a random number according to a Poisson law. More...
 
virtual void Rannor (Float_t &a, Float_t &b)
 Return 2 numbers distributed following a gaussian with mean=0 and sigma=1. More...
 
virtual void Rannor (Double_t &a, Double_t &b)
 Return 2 numbers distributed following a gaussian with mean=0 and sigma=1. More...
 
virtual void ReadRandom (const char *filename)
 Reads saved random generator status from filename. More...
 
virtual Double_t Rndm (Int_t)
 
virtual void Sphere (Double_t &x, Double_t &y, Double_t &z, Double_t r)
 Generates random vectors, uniformly distributed over the surface of a sphere of given radius. More...
 
virtual Double_t Uniform (Double_t x1=1)
 Returns a uniform deviate on the interval (0, x1). More...
 
virtual Double_t Uniform (Double_t x1, Double_t x2)
 Returns a uniform deviate on the interval (x1, x2). More...
 
virtual void WriteRandom (const char *filename) const
 Writes random generator status to filename. More...
 
- Public Member Functions inherited from ROOT::Math::TRandomEngine
virtual ~TRandomEngine ()
 

Static Public Member Functions

static void GetTableSeeds (UInt_t *seeds, Int_t index)
 static function returning the table of seeds More...
 

Protected Attributes

Float_t fCarry
 
Int_t fCount24
 
Float_t fFloatSeedTable [24]
 
Int_t fIlag
 
const Int_t fIntModulus
 
Int_t fJlag
 
Int_t fLuxury
 
const Double_t fMantissaBit12
 
const Double_t fMantissaBit24
 
Int_t fNskip
 
const UInt_t * fTheSeeds
 
- Protected Attributes inherited from TRandom
UInt_t fSeed
 

Static Protected Attributes

static Int_t fgMaxIndex = 215
 
static Int_t fgNumEngines = 0
 

#include <TRandom1.h>

Inheritance diagram for TRandom1:
[legend]

Constructor & Destructor Documentation

◆ TRandom1() [1/3]

TRandom1::TRandom1 ( )

default constructor

Definition at line 287 of file TRandom1.cxx.

◆ TRandom1() [2/3]

TRandom1::TRandom1 ( UInt_t  seed,
Int_t  lux = 3 
)

Luxury level is set in the same way as the original FORTRAN routine.

level 0 (p=24): equivalent to the original RCARRY of Marsaglia and Zaman, very long period, but fails many tests. level 1 (p=48): considerable improvement in quality over level 0, now passes the gap test, but still fails spectral test. level 2 (p=97): passes all known tests, but theoretically still defective. level 3 (p=223): DEFAULT VALUE. Any theoretically possible correlations have very small chance of being observed. level 4 (p=389): highest possible luxury, all 24 bits chaotic.

Definition at line 265 of file TRandom1.cxx.

◆ TRandom1() [3/3]

TRandom1::TRandom1 ( Int_t  rowIndex,
Int_t  colIndex,
Int_t  lux 
)

◆ ~TRandom1()

TRandom1::~TRandom1 ( )
virtual

destructor

Definition at line 341 of file TRandom1.cxx.

Member Function Documentation

◆ GetLuxury()

virtual Int_t TRandom1::GetLuxury ( ) const
inlinevirtual

Definition at line 49 of file TRandom1.h.

◆ GetSeed()

virtual UInt_t TRandom1::GetSeed ( ) const
inlinevirtual

Reimplemented from TRandom.

Definition at line 51 of file TRandom1.h.

◆ GetTableSeeds()

void TRandom1::GetTableSeeds ( UInt_t *  seeds,
Int_t  index 
)
static

static function returning the table of seeds

Definition at line 348 of file TRandom1.cxx.

◆ GetTheSeeds()

const UInt_t* TRandom1::GetTheSeeds ( ) const
inline

Definition at line 53 of file TRandom1.h.

◆ Rndm()

Double_t TRandom1::Rndm ( )
virtual

return a random number in ]0,1]

Reimplemented from TRandom.

Definition at line 360 of file TRandom1.cxx.

◆ RndmArray() [1/2]

void TRandom1::RndmArray ( Int_t  size,
Float_t *  vect 
)
virtual

return an array of random numbers in ]0,1]

Reimplemented from TRandom.

Definition at line 413 of file TRandom1.cxx.

◆ RndmArray() [2/2]

void TRandom1::RndmArray ( Int_t  size,
Double_t *  vect 
)
virtual

return an array of random numbers in ]0,1[

Reimplemented from TRandom.

Definition at line 421 of file TRandom1.cxx.

◆ SetSeed()

void TRandom1::SetSeed ( ULong_t  seed)
virtual

Set the random generator seed.

Note that default value is zero, which is different than the default value used when constructing the class. If the seed is zero the seed is set to a random value which in case of TRandom depends on the lowest 4 bytes of TUUID The UUID will be identical if SetSeed(0) is called with time smaller than 100 ns Instead if a different generator implementation is used (TRandom1, 2 or 3) the seed is generated using a 128 bit UUID. This results in different seeds and then random sequence for every SetSeed(0) call.

Reimplemented from TRandom.

Definition at line 619 of file TRandom1.cxx.

◆ SetSeed2()

void TRandom1::SetSeed2 ( UInt_t  seed,
Int_t  lux = 3 
)
virtual

The initialisation is carried out using a Multiplicative Congruential generator using formula constants of L'Ecuyer as described in "A review of pseudorandom number generators" (Fred James) published in Computer Physics Communications 60 (1990) pages 329-344.

modified for the case of seed = 0. In that case a random 64 bits seed based on TUUID (using TRandom3(0) ) is generated in order to have a unique seed

Definition at line 555 of file TRandom1.cxx.

◆ SetSeeds()

void TRandom1::SetSeeds ( const UInt_t *  seeds,
Int_t  lux = 3 
)
virtual

set seeds

Definition at line 478 of file TRandom1.cxx.

Member Data Documentation

◆ fCarry

Float_t TRandom1::fCarry
protected

Definition at line 36 of file TRandom1.h.

◆ fCount24

Int_t TRandom1::fCount24
protected

Definition at line 34 of file TRandom1.h.

◆ fFloatSeedTable

Float_t TRandom1::fFloatSeedTable[24]
protected

Definition at line 35 of file TRandom1.h.

◆ fgMaxIndex

int TRandom1::fgMaxIndex = 215
staticprotected

Definition at line 39 of file TRandom1.h.

◆ fgNumEngines

int TRandom1::fgNumEngines = 0
staticprotected

Definition at line 38 of file TRandom1.h.

◆ fIlag

Int_t TRandom1::fIlag
protected

Definition at line 32 of file TRandom1.h.

◆ fIntModulus

const Int_t TRandom1::fIntModulus
protected

Definition at line 37 of file TRandom1.h.

◆ fJlag

Int_t TRandom1::fJlag
protected

Definition at line 33 of file TRandom1.h.

◆ fLuxury

Int_t TRandom1::fLuxury
protected

Definition at line 31 of file TRandom1.h.

◆ fMantissaBit12

const Double_t TRandom1::fMantissaBit12
protected

Definition at line 42 of file TRandom1.h.

◆ fMantissaBit24

const Double_t TRandom1::fMantissaBit24
protected

Definition at line 41 of file TRandom1.h.

◆ fNskip

Int_t TRandom1::fNskip
protected

Definition at line 30 of file TRandom1.h.

◆ fTheSeeds

const UInt_t* TRandom1::fTheSeeds
protected

Definition at line 40 of file TRandom1.h.

Libraries for TRandom1:
[legend]

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