HepJamesRandom implements the algorithm by Marsaglia-Zaman RANMAR
described in "F.James, Comp. Phys. Comm. 60 (1990) 329" and
implemented in FORTRAN77 as part of the
MATHLIB HEP library for pseudo-random numbers generation.
This is the default random engine invoked by each distribution unless
the user sets a different one.
Author
Gabriele Cosmo
See also
Engines:
HepRandomEngine,
DRand48Engine ,
DualRand
Hurd160Engine
Hurd288Engine
MTwistEngine
RandEngine
RanecuEngine
RanluxEngine
Ranlux64Engine
RanshiEngine
TripleRand
Distributions:
HepRandom,
RandBinomial
RandBreitWigner
RandChiSquare
RandExponential
RandFlat
RandGamma
RandGauss
RandGeneral
RandPoisson
RandStudentT
Declaration
#include "CLHEP/Random/JamesRandom.h"
class HepJamesRandom : public HepRandomEngine
Public Member Functions
- Constructors
- HepJamesRandom()
- HepJamesRandom(long seed)
- HepJamesRandom(HepInt rowIndex, HepInt colIndex)
- HepJamesRandom(std::istream & is)
- Copy constructor
- HepJamesRandom(const HepJamesRandom & p)
- Destructor
- virtual ~HepJamesRandom()
- Conversion operator
- operator unsigned int()
- 32-bit flat, but slower than double or float.
- =
- HepJamesRandom & operator = (const HepJamesRandom &p)
- Overloaded assignment operator, to retrieve the engine status.
- flat
- HepDouble flat()
- Returns a pseudo random number between 0 and 1
- (excluding the end points)
- flatArray
- void flatArray (const HepInt size, HepDouble* vect)
- Fills an array vect of specified size with flat random values.
- restoreStatus
- void restoreStatus(const char filename[] = "JamesRand.conf")
- Reads from file JamesRand.conf the last saved engine status
and restores it.
- saveStatus
- void saveStatus(const char filename[] = "JamesRand.conf") const
- Saves on file JamesRand.conf the current engine status.
- setSeed
- void setSeed(long seed, HepInt dum=0)
- Sets the state of the algorithm according to seed.
- setSeeds
- void setSeeds(const long * seeds, HepInt dum=0)
- 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 HepJamesRandom & e)
- Output to a stream.
- >>
- std::istream & operator>> (std::istream & is,
HepJamesRandom & e)
- Input from a stream.
Example
CLHEP/test/testRandom.cc
04 May 1999
EVC