The algorithm for this random engine has been taken from the original
implementation in FORTRAN by Fred James as part of the
MATHLIB HEP library.
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".
Author
Adeyemi Adesanya and Gabriele Cosmo
See also
Engines:
HepRandomEngine,
DRand48Engine ,
DualRand
HepJamesRandom
Hurd160Engine
Hurd288Engine
MTwistEngine
RandEngine
RanecuEngine
Ranlux64Engine
RanshiEngine
TripleRand
Distributions:
HepRandom,
RandBinomial
RandBreitWigner
RandChiSquare
RandExponential
RandFlat
RandGamma
RandGauss
RandGeneral
RandPoisson
RandStudentT
Declaration
#include "CLHEP/Random/RanluxEngine.h"
class RanluxEngine : public HepRandomEngine
Public Member Functions
- Constructors
- RanluxEngine()
- RanluxEngine(std::istream& is)
- RanluxEngine(long seed, HepInt lux = 3)
- RanluxEngine(HepInt rowIndex, HepInt colIndex, HepInt lux)
- 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.
- Copy constructor
- RanluxEngine(const RanluxEngine &p)
- Destructor
- virtual ~RanluxEngine()
- Conversion operator
- operator unsigned int()
- 32-bit int flat, but slower than double or float
- =
- RanluxEngine & operator = (const RanluxEngine &p)
- Overloaded assignment operator, to retrieve the engine status.
- flat
- HepDouble flat()
- It returns a pseudo random number between 0 and 1,
excluding the end points.
- flatArray
- void flatArray (const HepInt size, HepDouble* vect)
- Fills the array vect of specified size with flat random values.
- getLuxury
- HepInt getLuxury() const
- Gets the luxury level.
- restoreStatus
- void restoreStatus(const char filename[] = "Ranlux.conf")
- Reads from file Ranlux.conf the last saved engine status
and restores it.
- saveStatus
- void saveStatus(const char filename[] = "Ranlux.conf") const
- Saves on file Ranlux.conf the current engine status.
- setSeed
- void setSeed(long seed, HepInt lux=3)
- Sets the state of the algorithm according to seed.
- setSeeds
- void setSeeds(const long * seeds, HepInt lux=3)
- Sets the state of the algorithm according to the zero terminated
array of seeds. Only the first seed is used.
- showStatus
- void showStatus() const
- Dumps the engine status on the screen.
Non-Member Functions
- <<
- std::ostream & operator<< (std::ostream & os,
const RanluxEngine & e)
- Output to a stream.
- >>
- std::istream & operator>> (std::istream & is,
RanluxEngine & e)
- Input from a stream.
Example
CLHEP/test/testRandom.cc
04 May 1999
EVC