HepRandomEngine is an abstract class defining the interface for each random engine. It implements the getSeed() and getSeeds() methods which return the initial seed value and the initial array of seeds respectively. It defines seven pure virtual functions: flat(), flatArray(), setSeed(), setSeeds(), saveStatus(), restoreStatus() and showStatus(), which are implemented by the concrete random engines each one inheriting from this abstract class.

Many concrete random engines can be defined and added to the structure, simply making them inheriting from HepRandomEngine and definingf the six functions flat(), flatArray(), setSeed(), setSeeds(), saveStatus(), restoreStatus() and showStatus() in such a way that flat() and flatArray() return double random values ranging between ]0,1[.

All the random engines have a default seed value already set but they can be instantiated with a different seed value set up by the user.


Gabriele Cosmo

See also

Engines: DRand48Engine , DualRand, HepJamesRandom, Hurd160Engine, Hurd288Engine, MTwistEngine, RandEngine, RanecuEngine, RanluxEngine, Ranlux64Engine, RanshiEngine, TripleRand

Distributions: HepRandom, RandBinomial, RandBit, RandBreitWigner, RandChiSquare, RandExponential, RandFlat, RandGamma, RandGauss, RandGaussQ, RandGaussT, RandGeneral, RandLandau, RandPoisson, RandPoissonQ, RandPoissonT, RandStudentT

Functions: HepStat


#include "CLHEP/Random/RandomEngine.h"

class HepRandomEngine

Public Member Functions

virtual ~HepRandomEngine()
Conversion operators
virtual operator HepDouble()
Returns same as flat()

virtual operator HepFloat()
Less precise flat, faster if possible

virtual operator unsigned int()
32-bit int flat, faster if possible
inline HepBoolean operator==(const HepRandomEngine& engine)
Overloaded equality operator.
inline HepBoolean operator!=(const HepRandomEngine& engine)
Overloaded inequality operator.
virtual HepDouble flat() = 0
Should return a pseudo random number between 0 and 1, excluding the end points.
virtual void flatArray(const HepInt size, HepDouble* vect) = 0
Fills an array vect of specified size with flat random values.
long getSeed() const
Gets the current seed.
const long* getSeeds() const
Gets the current array of seeds.
void getTableSeeds(long* seeds, HepInt index) const
Gets back seed values stored in the table, given the index.
virtual void restoreStatus(const char filename[] = "Config.conf") = 0
Should read from a file (specific to the instantiated engine in use) and restore the last saved engine configuration.
virtual void saveStatus(const char filename[] = "Config.conf") const = 0
Should save on a file specific to the instantiated engine in use the current status.
virtual void setSeed(long seed, HepInt) = 0
Should initialise the status of the algorithm according to seed.
virtual void setSeeds(const long * seeds, HepInt) = 0
Should initialise the status of the algorithm according to the zero terminated array of seeds. It is allowed to ignore one or many seeds in this array.
virtual void showStatus() const = 0
Should dump the current engine status on the screen.

15 May 2000