Logo ROOT   6.12/07
Reference Guide
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ROOT::Math::MersenneTwisterEngine Class Reference

Random number generator class based on M.

Matsumoto and T. Nishimura, Mersenne Twister: A 623-diminsionally equidistributed uniform pseudorandom number generator ACM Transactions on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3–30.

For more information see the Mersenne Twister homepage [http://www.math.keio.ac.jp/~matumoto/emt.html]

Advantage:

Note that this is a 32 bit implementation. Only 32 bits of the returned double numbers are random. in case more precision is needed, one should use an engine providing at least 48 random bits.

Drawback: a relative large internal state of 624 integers

Definition at line 50 of file MersenneTwisterEngine.h.

Public Types

typedef TRandomEngine BaseType
 
typedef uint32_t Result_t
 
typedef uint32_t StateInt_t
 

Public Member Functions

 MersenneTwisterEngine (uint32_t seed=4357)
 
virtual ~MersenneTwisterEngine ()
 
uint32_t IntRndm ()
 
double operator() ()
 
virtual double Rndm ()
 
void SetSeed (Result_t seed)
 set the seed x More...
 
- Public Member Functions inherited from ROOT::Math::TRandomEngine
virtual ~TRandomEngine ()
 

Static Public Member Functions

static unsigned int MaxInt ()
 maximum integer taht can be generated More...
 
static unsigned int MinInt ()
 minimum integer taht can be generated More...
 
static std::string Name ()
 
static int Size ()
 

Protected Member Functions

int Counter () const
 
void GetState (std::vector< uint32_t > &state)
 
void SetState (const std::vector< uint32_t > &state)
 

Private Types

enum  { kSize =624 }
 

Private Member Functions

uint32_t IntRndm_impl ()
 
double Rndm_impl ()
 generate a random double number More...
 

Private Attributes

int fCount624
 
uint32_t fMt [kSize]
 

#include <Math/MersenneTwisterEngine.h>

Inheritance diagram for ROOT::Math::MersenneTwisterEngine:
[legend]

Member Typedef Documentation

◆ BaseType

Definition at line 55 of file MersenneTwisterEngine.h.

◆ Result_t

Definition at line 56 of file MersenneTwisterEngine.h.

◆ StateInt_t

Definition at line 57 of file MersenneTwisterEngine.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kSize 

Definition at line 111 of file MersenneTwisterEngine.h.

Constructor & Destructor Documentation

◆ MersenneTwisterEngine()

ROOT::Math::MersenneTwisterEngine::MersenneTwisterEngine ( uint32_t  seed = 4357)
inline

Definition at line 60 of file MersenneTwisterEngine.h.

◆ ~MersenneTwisterEngine()

virtual ROOT::Math::MersenneTwisterEngine::~MersenneTwisterEngine ( )
inlinevirtual

Definition at line 64 of file MersenneTwisterEngine.h.

Member Function Documentation

◆ Counter()

int ROOT::Math::MersenneTwisterEngine::Counter ( ) const
inlineprotected

Definition at line 103 of file MersenneTwisterEngine.h.

◆ GetState()

void ROOT::Math::MersenneTwisterEngine::GetState ( std::vector< uint32_t > &  state)
inlineprotected

Definition at line 97 of file MersenneTwisterEngine.h.

◆ IntRndm()

uint32_t ROOT::Math::MersenneTwisterEngine::IntRndm ( )
inline

Definition at line 73 of file MersenneTwisterEngine.h.

◆ IntRndm_impl()

uint32_t ROOT::Math::MersenneTwisterEngine::IntRndm_impl ( )
private

◆ MaxInt()

static unsigned int ROOT::Math::MersenneTwisterEngine::MaxInt ( )
inlinestatic

maximum integer taht can be generated

Definition at line 80 of file MersenneTwisterEngine.h.

◆ MinInt()

static unsigned int ROOT::Math::MersenneTwisterEngine::MinInt ( )
inlinestatic

minimum integer taht can be generated

Definition at line 78 of file MersenneTwisterEngine.h.

◆ Name()

static std::string ROOT::Math::MersenneTwisterEngine::Name ( )
inlinestatic

Definition at line 84 of file MersenneTwisterEngine.h.

◆ operator()()

double ROOT::Math::MersenneTwisterEngine::operator() ( )
inline

Definition at line 71 of file MersenneTwisterEngine.h.

◆ Rndm()

virtual double ROOT::Math::MersenneTwisterEngine::Rndm ( )
inlinevirtual

Implements ROOT::Math::TRandomEngine.

Definition at line 68 of file MersenneTwisterEngine.h.

◆ Rndm_impl()

double ROOT::Math::MersenneTwisterEngine::Rndm_impl ( )
private

generate a random double number

Definition at line 37 of file MersenneTwisterEngine.cxx.

◆ SetSeed()

void ROOT::Math::MersenneTwisterEngine::SetSeed ( Result_t  seed)

set the seed x

Definition at line 24 of file MersenneTwisterEngine.cxx.

◆ SetState()

void ROOT::Math::MersenneTwisterEngine::SetState ( const std::vector< uint32_t > &  state)
inlineprotected

Definition at line 91 of file MersenneTwisterEngine.h.

◆ Size()

static int ROOT::Math::MersenneTwisterEngine::Size ( )
inlinestatic

Definition at line 82 of file MersenneTwisterEngine.h.

Member Data Documentation

◆ fCount624

int ROOT::Math::MersenneTwisterEngine::fCount624
private

Definition at line 115 of file MersenneTwisterEngine.h.

◆ fMt

uint32_t ROOT::Math::MersenneTwisterEngine::fMt[kSize]
private

Definition at line 114 of file MersenneTwisterEngine.h.

Libraries for ROOT::Math::MersenneTwisterEngine:
[legend]

The documentation for this class was generated from the following files: