HEP Random is a collection of random number engines and a variety of distributions which use those engines to generate pseudo-random numbers.
The ZOOM validation consists of
The additional methods are listed here.
![]()
RandEngine(); DRand48Engine(); HepJamesRandom(); RanecuEngine(); RanluxEngine();Note: The default constructor will assign a unique seed for each instance. Thus two default engines of the same type will produce two different sequences.
RandEngine(HepInt rowIndex, HepInt colIndex); DRand48Engine(HepInt rowIndex, HepInt colIndex); HepJamesRandom(HepInt rowIndex, HepInt colIndex); RanecuEngine(HepInt index); For RanecuEngine the two-index form is not present; the single index form both acts as an index into the table and coincides with the behavior of the original package. RanluxEngine(HepInt rowIndex, HepInt colIndex, HepInt lux); RanecuEngine requires the user specify the lux level when the row and column index form of constructor is used. Normally, the high luxury level (3) should be specified.The constructor accepting a single long as a seed will behave exactly as in the original: It will assign a seed based on the long provided. Thus existing programs using this form of constructor will give the same random sequence as in the original package.
RandEngine(long seed); DRand48Engine(long seed); HepJamesRandom(long seed); RanecuEngine(HepInt index); RanluxEngine(long seed, HepInt lux = 3);
RandEngine(istream & is); DRand48Engine(istream & is); HepJamesRandom(istream & is); RanecuEngine(istream & is); RanluxEngine(istream & is);
void saveStatus( const char filename[] = "Rand.conf" ) const; void saveStatus( const char filename[] = "DRand48.conf" ) const; void saveStatus( const char filename[] = "JamesRand.conf" ) const; void saveStatus( const char filename[] = "Ranecu.conf" ) const; void saveStatus( const char filename[] = "Ranlux.conf" ) const; void restoreStatus( const char filename[] = "Rand.conf" ); void restoreStatus( const char filename[] = "DRand48.conf" ); void restoreStatus( const char filename[] = "JamesRand.conf" ); void restoreStatus( const char filename[] = "Ranlux.conf" );
friend ostream& operator<< (ostream& os, const RandEngine& e); friend ostream& operator<< (ostream& os, const DRand48Engine& e); friend ostream& operator<< (ostream& os, const HepJamesRandom& e); friend ostream& operator<< (ostream& os, const RanecuEngine& e); friend ostream& operator<< (ostream& os, const RanluxEngine& e); friend istream& operator>> (istream& is, RandEngine& e); friend istream& operator>> (istream& is, DRand48Engine& e); friend istream& operator>> (istream& is, HepJamesRandom& e); friend istream& operator>> (istream& is, RanecuEngine& e); friend istream& operator>> (istream& is, RanluxEngine& e);
RanluxEngine e;
RanGauss g(e);
double x = g(); ...
// Exercise the engine several times.
RanluxEngine savedEngine (e); // The key step:
// Use the copy constructor!
double x = g(); ...
// Exercise the engine several more times.
// Now if we want to get back to that saved state,
e = savedEngine;
RandEngine e;
RandGauss r(e);
x = r();
r.fire ( mean, sigma );
RandBreitWigner::HepDouble operator()(HepDouble a, HepDouble b ); RandBreitWigner::HepDouble operator()(HepDouble a, HepDouble b, HepDouble c); RandExponential::HepDouble operator()(HepDouble mean ); RandFlat::HepDouble operator()(HepDouble width ); RandFlat::HepDouble operator()(HepDouble a, HepDouble b ); RandGauss::HepDouble operator()(HepDouble mean, HepDouble stdDev ); RandPoisson::HepDouble operator()(HepDouble m);
void HepRandom::saveStatus( const char filename[] = "Config.conf" ) const; void HepRandom::restoreStatus( const char filename[] = "Config.conf" ) const;
ZMRandFlat ( HepRandomEngine& anEngine,
HepDouble defaultRmin=0.0, HepDouble defaultRmax=1.0 );
ZMRandGauss ( HepRandomEngine& anEngine,
HepDouble mean=0.0, HepDouble sig=1.0 )
ZMRandPoisson ( HepRandomEngine& anEngine,
HepDouble mean = 1.0 );
ZMRandExponential ( HepRandomEngine& anEngine,
HepDouble mean=1.0 );
ZMRandBreitWigner ( HepRandomEngine& anEngine,
HepDouble mean=1.0, HepDouble gamma=0.2, HepDouble cut=1.0 );
(Corresponding constructors accepting HepRandomEngine* are also present.)
For example:
JamesRandom e; ZMRandGauss g0 (e); ZMRandGauss g3 (e, 3.0, 1.5); double x; g0.fire(); // Random Gaussian with mean = 0, sigma = 1 g0.fire(5.0, 2.0); // Random Gaussian with mean = 5, sigma = 2 g3.fire(); // Random Gaussian with mean = 3, sigma = 1.5 g0.fire(6.0, 3.0); // Random Gaussian with mean = 6, sigma = 3
![]()