Simple random engine using rand() and srand() functions
from C standard library to implement the flat() basic
distribution and for setting seeds.
Copy constructor and operator= are private for objects of this
class.
Author
Gabriele Cosmo
See also
Engines:
HepRandomEngine,
DRand48Engine ,
DualRand
HepJamesRandom
Hurd160Engine
Hurd288Engine
MTwistEngine
RanecuEngine
RanluxEngine
Ranlux64Engine
RanshiEngine
TripleRand
Distributions:
HepRandom,
RandBinomial
RandBreitWigner
RandChiSquare
RandExponential
RandFlat
RandGamma
RandGauss
RandGeneral
RandPoisson
RandStudentT
Declaration
#include "CLHEP/Random/RandEngine.h"
class RandEngine : public HepRandomEngine
Public Member Functions
- Constructors
- RandEngine()
- RandEngine(long seed)
- RandEngine(HepInt rowIndex, HepInt colIndex)
- RandEngine(std::istream& is)
- Destructor
- virtual ~RandEngine()
- Conversion operator
- operator unsigned int()
- 32-bit flat value, quickest of all
- flat
- HepDouble flat()
- It returns a pseudo random number between 0 and 1,
according to the standard stdlib random function
rand() but excluding the end points.
- flatArray
- void flatArray (const HepInt size, HepDouble* vect)
- Fills the array vect of specified size with flat random values.
- restoreStatus
- void restoreStatus(const char filename[] = "Rand.conf")
- Reads from file Rand.conf the last saved engine status
and restores it.
- saveStatus
- void saveStatus(const char filename[] = "Rand.conf") const
- Saves on file Rand.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 RandEngine & e)
- Output to a stream.
- >>
- std::istream & operator>> (std::istream & is,
RandEngine & e)
- Input from a stream.
Example
CLHEP/test/testRandom.cc
04 May 1999
EVC