HepRandom


It's a singleton instantiated by default within the HEP Random module. It uses an instantiated HepJamesRandom engine as default algorithm for pseudo-random number generation.

HepRandom defines a static private data member theGenerator and a set of static inlined methods to manipulate it. By means of theGenerator the user can change the underlying engine algorithm, get and set the seeds and use any kind of defined random distribution.

Distribution classes inherit from HepRandom and define both static and not-static interfaces.

A static table of uncorrelated seeds is available in this class.

A static method getTheTableSeeds() is defined to access a couple of seeds at a given index in the table.

Author

Gabriele Cosmo

See also

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

Distributions: RandBinomial RandBreitWigner RandChiSquare RandExponential RandFlat RandGamma RandGauss RandGeneral RandPoisson RandStudentT

Declaration

#include "CLHEP/Random/Random.h"

class HepRandom

Public Member Functions

Constructors
HepRandom()
Contructors without a seed using the default engine (JamesRandom).

HepRandom(long seed)
Contructors with a seed using the default engine (JamesRandom).

HepRandom(HepRandomEngine & algorithm)
HepRandom(HepRandomEngine * algorithm)
Constructor taking an alternative engine as argument. If a pointer is given then the corresponding object will be deleted by the HepRandom destructor.
Destructor
virtual ~HepRandom()
()
virtual HepDouble operator()()
To get a flat random number using the operator().
createInstance
static HepInt createInstance()
Create a single instance of the generator, it returns 0 if the singleton is already instantiated.
flat
HepDouble flat()
Returns the flat value ( interval ]0,1[ ).

inline HepDouble flat (HepRandomEngine* theNewEngine)
Returns a flat value, given a defined Random Engine.
flatArray
void flatArray(const HepInt size, HepDouble* vect)
Fills vect array of flat random values, given the size.

inline void flatArray(HepRandomEngine* theNewEngine, const HepInt size, HepDouble* vect)
Fills vect array of flat random values, given the size and a defined Random Engine.
getTheEngine static HepRandomEngine * getTheEngine()
Returns a pointer to the underlying algorithm object.
getTheGenerator
static HepRandom * getTheGenerator()
Return the current static generator.
getTheSeed
static long getTheSeed()
Gets the current seed of the current generator.
getTheSeeds
static const long* getTheSeeds()
Gets the current array of seeds of the current generator.
getTheTableSeeds
static void getTheTableSeeds(long* seeds, HepInt index)
Gets the array of seeds in the static seedTable at "index" position.
restoreEngineStatus
static void restoreEngineStatus(const char filename[] = "Config.conf")
Restores a saved status (if any) for the current engine.
saveEngineStatus
static void saveEngineStatus(const char filename[] = "Config.conf")
Saves to file the current status of the current engine.
setTheSeed
static void setTheSeed(long seed, HepInt lux=3)
(Re)Initializes the generator with a seed.
setTheSeeds
static void setTheSeeds(const long* seeds, HepInt aux=-1)
(Re)Initializes the generator with a zero terminated list of seeds.
setTheEngine
static void setTheEngine(HepRandomEngine* theNewEngine)
To set the underlying algorithm object.
showEngineStatus
static void showEngineStatus()
Dumps the current engine status on screen.


04 May 1999
EVC