RandomLib  1.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
RandomLib::MixerMT1< RandomType > Class Template Reference

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)
 

Detailed Description

template<class RandomType>
class RandomLib::MixerMT1< RandomType >

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.

Template Parameters
RandomTypethe type of the results, either Random_u32 or Random_u64.

Definition at line 145 of file RandomMixer.hpp.

Member Typedef Documentation

template<class RandomType >
typedef RandomType RandomLib::MixerMT1< RandomType >::mixer_t

The RandomType controlling the output of MixerMT1::SeedToState

Definition at line 150 of file RandomMixer.hpp.

Member Function Documentation

template<class RandomType >
void RandomLib::MixerMT1< RandomType >::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.

Parameters
[in]seedthe input seed vector.
[out]statethe generator state.
[in]nthe size of the state.

Definition at line 565 of file Random.cpp.

template<class RandomType >
static std::string RandomLib::MixerMT1< RandomType >::Name ( )
inlinestatic

Return the name of this class.

Returns
the name.

Definition at line 182 of file RandomMixer.hpp.

Member Data Documentation

template<class RandomType >
const unsigned RandomLib::MixerMT1< RandomType >::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 156 of file RandomMixer.hpp.


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