Hurd160Engine


The starting point for the Hurd Random algorithm is the paper in IEEE Transactions on Computers c23, 2 Feb 1974. The algorithm is essentially a series of 32 interconnected b-bit registers. The basic property is that at each step, bit 1 becomes bit 0, bit 2 the new bit 1, bit b the new bit b-1. This is modified so that the new bit b0 is the old bit b1 XOR'd with some bit b-d from the previous bit register. The values of d can be chosen so as to generate a primitive polynomial, a maximal length sequence through all bit patterns except the zero pattern.

This generator, Hurd160 use values based upon Table I of the afore mentioned paper, such that we have 160 total bits, representing 32 5-bit registers (actually implemented as an array of 5 32-bit words)

Author

Ken Smith

See also

Engines: HepRandomEngine, DRand48Engine , DualRand, HepJamesRandom, 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

Declaration

#include "CLHEP/Random/Hurd160Engine.h"

class Hurd160Engine: public HepRandomEngine

Public Member Functions

Constructors
Hurd160Engine()
Hurd160Engine(long seed)
Hurd160Engine(HepInt rowIndex, HepInt colIndex)
Hurd160Engine(HepStd::istream& is)
Copy constructor
Hurd160Engine(const Hurd160Engine & p)
Destructor
virtual ~Hurd160Engine()
Conversion operators
operator HepFloat()
Flat value, without worrying about filling bits

operator unsigned int()
32-bit flat value, quickest of all
=
Hurd160Engine & operator=(const Hurd160Engine & p)
Assignment
flat
HepDouble flat()
Returns a pseudo random number between 0 and 1
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[] = "Hurd160Engine.conf")
Reads from named file the last saved engine status and restores it.
saveStatus
void saveStatus(const char filename[] = "Hurd160Engine.conf") const
Saves on named file the current engine status.
setSeed
void setSeed(long seed, HepInt)
Sets the state of the algorithm according to seed.
setSeeds
void setSeeds(const long * seeds, HepInt)
Sets the state of the algorithm according to the zero-terminated array of seeds.
showStatus
void showStatus() const
Dumps the current engine status on the screen.

Non-Member Functions

<<
HepStd::ostream & operator<< (HepStd::ostream & os, const Hurd160Engine & e)
Output to a stream.
>>
HepStd::istream & operator>> (HepStd::istream & is, Hurd160Engine & e)
Input from a stream.

Example

CLHEP/test/testRandom.cc


15 May 2000
EVC