MTwistEngine


A "fast, compact, huge-period generator" based on M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", to appear in ACM Trans. on Modeling and Computer Simulation. It is a twisted GFSR generator with a Mersenne-prime period of 2^19937-1, uniform on open interval (0,1) For further information, see http://www.math.keio.ac.jp/~matumoto/emt.html

Author

Ken Smith

See also

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

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

Declaration

#include "CLHEP/Random/MTwistEngine.h"

class MTwistEngine: public HepRandomEngine

Public Member Functions

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

operator unsigned int()
32-bit flat value, quickest of all
=
MTwistEngine & operator=(const MTwistEngine & p)
Assignment
flat
HepDouble flat()
Returns a pseudo random number between 0 and 1 (excluding the end points).
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[] = "MTwist.conf")
Reads from named file the last saved engine status and restores it.
saveStatus
void saveStatus(const char filename[] = "MTwist.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 MTwistEngine & e)
Output to a stream.
>>
std::istream & operator>> (std::istream & is, MTwistEngine & e)
Input from a stream.

Example

CLHEP/test/testRandom.cc


04 May 1999
EVC