Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Math::MersenneTwisterEngine Class Reference

Random number generator class based on M.

Matsumoto and T. Nishimura, Mersenne Twister: A 623-dimensionally 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)
 
 ~MersenneTwisterEngine () override
 
uint32_t IntRndm ()
 
double operator() ()
 
double Rndm () override
 
void SetSeed (Result_t seed)
 set the seed x
 
- Public Member Functions inherited from ROOT::Math::TRandomEngine
virtual ~TRandomEngine ()
 

Static Public Member Functions

static unsigned int MaxInt ()
 maximum integer that can be generated
 
static unsigned int MinInt ()
 minimum integer that can be generated
 
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
 

Private Attributes

int fCount624
 
uint32_t fMt [kSize]
 

#include <Math/MersenneTwisterEngine.h>

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

Member Typedef Documentation

◆ BaseType

◆ 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()

ROOT::Math::MersenneTwisterEngine::~MersenneTwisterEngine ( )
inlineoverride

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 that can be generated

Definition at line 80 of file MersenneTwisterEngine.h.

◆ MinInt()

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

minimum integer that 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()

double ROOT::Math::MersenneTwisterEngine::Rndm ( )
inlineoverridevirtual

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:

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