RandomLib
1.10
|
The SFMT random number engine. More...
#include <RandomLib/RandomAlgorithm.hpp>
Public Types | |
enum | { N = N128 * R } |
typedef RandomType | engine_t |
typedef engine_t::type | internal_type |
Public Member Functions | |
template<> | |
void | Transition (long long count, internal_type statev[]) throw() |
template<> | |
void | Transition (long long count, internal_type statev[]) throw() |
template<> | |
void | NormalizeState (engine_type state[]) throw() |
template<> | |
void | NormalizeState (engine_type state[]) throw() |
Static Public Member Functions | |
static void | Transition (long long count, internal_type statev[]) throw () |
static engine_type | Generate (engine_type y) throw () |
static void | NormalizeState (engine_type state[]) throw () |
static void | CheckState (const engine_type state[], Random_u32::type &check) |
static std::string | Name () throw () |
Static Public Attributes | |
static const unsigned | version = 0x456e534dUL + (engine_t::width/32 - 1) |
The SFMT random number engine.
This provides an implementation of the SIMD-oriented Fast Mersenne Twister random number engine, SFMT. See
Mutsuo Saito,
An Application of Finite Field: Design and Implementation of 128-bit Instruction-Based Fast Pseudorandom Number Generator,
Master's Thesis, Dept. of Math., Hiroshima University (Feb. 2007).
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/M062821.pdf Mutsuo Saito and Makoto Matsumoto,
SIMD-oriented Fast Mersenne Twister: a 128-bit Pseudorandom Number Generator,
accepted in the proceedings of MCQMC2006
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/sfmt.pdf
The template argument gives the type RandomType of the "natural" result. This incorporates the bit width and the C++ type of the result. The 32-bit and 64-bit versions of SFMT19937 produce the same sequences and the differing only in whether how the state is represented. The implementation includes a version using 128-bit SSE2 instructions. On machines without these instructions, portable implementations using traditional operations are provided. With the same starting seed, SRandom32::Ran64() and SRandom64::Ran64() produces the same sequences. Similarly SRandom64::Ran32() produces every other member of the sequence produced by SRandom32::Ran32().
The class chiefly supplies the method for advancing the state by Transition.
RandomType | the type of the results, either Random_u32 or Random_u64. |
Written by Charles Karney charl and licensed under the MIT/X11 License. For more information, see es@k arney .comhttp://randomlib.sourceforge.net/
Definition at line 233 of file RandomAlgorithm.hpp.
typedef RandomType RandomLib::SFMT19937< RandomType >::engine_t |
The result RandomType
Definition at line 238 of file RandomAlgorithm.hpp.
typedef engine_t::type RandomLib::SFMT19937< RandomType >::internal_type |
The internal numeric type for SFMT19337::Transition
Definition at line 247 of file RandomAlgorithm.hpp.
anonymous enum |
Enumerator | |
---|---|
N |
The size of the state. The long lag for SFMT19937 |
Definition at line 322 of file RandomAlgorithm.hpp.
|
static |
Advance state by count batches. For speed all N words of state are advanced together. If count is negative, the state is stepped backwards. This is the meat of the SFMT19937 engine.
[in] | count | how many batches to advance. |
[in,out] | statev | the internal state of the random number generator. |
|
inlinestatic |
Manipulate a word of the state prior to output. This is a no-op for SFMT19937.
[in] | y | a word of the state. |
Definition at line 346 of file RandomAlgorithm.hpp.
|
static |
Convert an arbitrary state into a legal one. This consists a "period certification to ensure that the period of the generator is at least 2P − 1.
[in,out] | state | the state of the generator. |
|
static |
Check that the state is legal, throwing an exception if it is not. This merely verifies that the state is not all zero. At the same time, accumulate a checksum of the state.
[in] | state | the state of the generator. |
[in,out] | check | an accumulated checksum. |
Definition at line 1170 of file Random.cpp.
|
inlinestatic |
void RandomLib::SFMT19937< Random_u32 >::Transition | ( | long long | count, |
internal_type | statev[] | ||
) | |||
throw | ( | ||
) |
Definition at line 1041 of file Random.cpp.
References SFMT19937_REVSTEP32, and SFMT19937_STEP32.
void RandomLib::SFMT19937< Random_u64 >::Transition | ( | long long | count, |
internal_type | statev[] | ||
) | |||
throw | ( | ||
) |
Definition at line 1108 of file Random.cpp.
References SFMT19937_REVSTEP64, and SFMT19937_STEP64.
void RandomLib::SFMT19937< Random_u32 >::NormalizeState | ( | engine_type | state[] | ) | |
throw | ( | ||||
) |
Definition at line 1141 of file Random.cpp.
References STATIC_ASSERT.
void RandomLib::SFMT19937< Random_u64 >::NormalizeState | ( | engine_type | state[] | ) | |
throw | ( | ||||
) |
Definition at line 1156 of file Random.cpp.
References STATIC_ASSERT.
|
static |
A version number "EnSM" or "EnSN" to ensure safety of Save/Load. This needs to be unique across RandomAlgorithms.
Definition at line 321 of file RandomAlgorithm.hpp.