RandomLib
1.10
|
The modified MT19937 mixing functionality. More...
#include <RandomLib/RandomMixer.hpp>
Public Types | |
typedef RandomType | mixer_t |
Static Public Member Functions | |
static void | SeedToState (const std::vector< RandomSeed::seed_type > &seed, mixer_type state[], unsigned n) throw () |
static std::string | Name () |
Static Public Attributes | |
static const unsigned | version = 0x4d784d56UL + (mixer_t::width == 64) |
The modified MT19937 mixing functionality.
MixerMT0 has two defects
MixerMT1 fixes these defects in a straightforward manner. The resulting algorithm was included in one of the proposals for Random Number Generation for C++0X, see Brown, et al., http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2079.pdf
The template parameter RandomType switches between the 32-bit and 64-bit versions.
MixerMT1 still has a weakness in that it doesn't thoroughly mix the state. This is illustrated by an example given to me by Makoto Matsumoto: Consider a seed of length N and suppose we consider all WN/2 values for the first half of the seed (here W = 2width). MixerMT1 has a bottleneck in the way that the state is initialized which results in the second half of the state only taking on W2 possible values. MixerSFMT mixes the seed into the state much more thoroughly.
RandomType | the type of the results, either Random_u32 or Random_u64. |
Definition at line 145 of file RandomMixer.hpp.
typedef RandomType RandomLib::MixerMT1< RandomType >::mixer_t |
The RandomType controlling the output of MixerMT1::SeedToState
Definition at line 150 of file RandomMixer.hpp.
|
static |
Mix the seed vector, seed, into the state array, state, of size n.
[in] | seed | the input seed vector. |
[out] | state | the generator state. |
[in] | n | the size of the state. |
Definition at line 565 of file Random.cpp.
|
inlinestatic |
|
static |
A version number which should be unique to this RandomMixer. This prevents RandomEngine::Load from loading a saved generator with a different RandomMixer. Here the version is "MxMV" or "MxMW".
Definition at line 156 of file RandomMixer.hpp.