Hurd288Engine


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, Hurd288, use values based upon Table I of the afore mentioned paper, such that we have 288 total bits, representing 32 9-bit registers (actually implemented as an array of 9 32-bit words)

Author

Ken Smith

See also

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

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

Declaration

#include "CLHEP/Random/Hurd288Engine.h"

class Hurd288Engine: public HepRandomEngine

Public Member Functions

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

operator unsigned int()
32-bit flat value, quickest of all
=
Hurd288Engine & operator=(const Hurd288Engine & 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[] = "Hurd288Engine.conf")
Reads from named file the last saved engine status and restores it.
saveStatus
void saveStatus(const char filename[] = "Hurd288Engine.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

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

Example

CLHEP/test/testRandom.cc


04 May 1999
EVC