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>
Definition at line 55 of file MersenneTwisterEngine.h.
typedef uint32_t ROOT::Math::MersenneTwisterEngine::Result_t |
Definition at line 56 of file MersenneTwisterEngine.h.
typedef uint32_t ROOT::Math::MersenneTwisterEngine::StateInt_t |
Definition at line 57 of file MersenneTwisterEngine.h.
|
private |
Enumerator | |
---|---|
kSize |
Definition at line 111 of file MersenneTwisterEngine.h.
|
inline |
Definition at line 60 of file MersenneTwisterEngine.h.
|
inlineoverride |
Definition at line 64 of file MersenneTwisterEngine.h.
|
inlineprotected |
Definition at line 103 of file MersenneTwisterEngine.h.
|
inlineprotected |
Definition at line 97 of file MersenneTwisterEngine.h.
|
inline |
Definition at line 73 of file MersenneTwisterEngine.h.
|
private |
|
inlinestatic |
maximum integer that can be generated
Definition at line 80 of file MersenneTwisterEngine.h.
|
inlinestatic |
minimum integer that can be generated
Definition at line 78 of file MersenneTwisterEngine.h.
|
inlinestatic |
Definition at line 84 of file MersenneTwisterEngine.h.
|
inline |
Definition at line 71 of file MersenneTwisterEngine.h.
|
inlineoverridevirtual |
Implements ROOT::Math::TRandomEngine.
Definition at line 68 of file MersenneTwisterEngine.h.
|
private |
generate a random double number
Definition at line 37 of file MersenneTwisterEngine.cxx.
void ROOT::Math::MersenneTwisterEngine::SetSeed | ( | Result_t | seed | ) |
set the seed x
Definition at line 24 of file MersenneTwisterEngine.cxx.
|
inlineprotected |
Definition at line 91 of file MersenneTwisterEngine.h.
|
inlinestatic |
Definition at line 82 of file MersenneTwisterEngine.h.
|
private |
Definition at line 115 of file MersenneTwisterEngine.h.
|
private |
Definition at line 114 of file MersenneTwisterEngine.h.