Public Types | Static Public Member Functions | Static Public Attributes | Private Types | Private Attributes | Static Private Attributes
RandomLib::MixerMT1 Class Reference

The modified MT19937 mixing functionality. More...

#include <RandomLib-2010-01/RandomMixer.hpp>

List of all members.

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

Static Public Attributes

static const unsigned version = 0x4d784d56UL + (mixer_t::width == 64)

Private Types

typedef mixer_t::type mixer_type

Private Attributes

static const mixer_type b = mixer_t::width == 32 ? 1812433253ULL : 6364136223846793005ULL
static const mixer_type c = mixer_t::width == 32 ? 1664525ULL : 3935559000370003845ULL
static const mixer_type d = mixer_t::width == 32 ? 1566083941ULL : 2862933555777941757ULL

Static Private Attributes

static const mixer_type mask = mixer_t::mask
static const mixer_type a = 5489ULL

Detailed Description

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.


Member Typedef Documentation

The RandomType controlling the output of MixerMT1::SeedToState

Definition at line 135 of file RandomMixer.hpp.

The unsigned type corresponding to mixer_t.

Definition at line 146 of file RandomMixer.hpp.


Member Function Documentation

void RandomLib::MixerMT1::SeedToState ( const std::vector< RandomSeed::seed_type > &  seed,
mixer_type  state[],
unsigned  n 
) throw () [static]

Mix the seed vector, seed, into the state array, state, of size n.

Definition at line 566 of file Random.cpp.

static std::string RandomLib::MixerMT1::Name ( ) throw () [inline, static]

Return the name of this class.

Definition at line 161 of file RandomMixer.hpp.

References RandomLib::RandomType::width.


Member Data Documentation

const unsigned RandomLib::MixerMT1::version = 0x4d784d56UL + (mixer_t::width == 64) [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 141 of file RandomMixer.hpp.

The mask for mixter_t.

Definition at line 150 of file RandomMixer.hpp.

const mixer_type RandomLib::MixerMT1::a = 5489ULL [static, private]

Definition at line 166 of file RandomMixer.hpp.

const mixer_type RandomLib::MixerMT1::b = mixer_t::width == 32 ? 1812433253ULL : 6364136223846793005ULL [private]

Definition at line 167 of file RandomMixer.hpp.

const mixer_type RandomLib::MixerMT1::c = mixer_t::width == 32 ? 1664525ULL : 3935559000370003845ULL [private]

Definition at line 168 of file RandomMixer.hpp.

const mixer_type RandomLib::MixerMT1::d = mixer_t::width == 32 ? 1566083941ULL : 2862933555777941757ULL [private]

Definition at line 169 of file RandomMixer.hpp.


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