Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val > Class Template Reference

MersenneTwister class pattern. More...

#include <arcane/core/random/MersenneTwister.h>

Collaboration diagram for Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >:

Public Types

typedef UIntType result_type

Public Member Functions

 MersenneTwister ()
 Constructor with seed initialization from the seed() method.
 MersenneTwister (UIntType value)
 Constructor with initialization of the seed array from the value value. The call to the seed(value) method is performed.
template<class It>
 MersenneTwister (It &first, It last)
 Constructor with initialization of the seed array from the seed(first,last) method.
template<class Generator>
 MersenneTwister (Generator &gen)
 Constructor with initialization of the seed array from the generator gen. gen must contain the () operator which must return a value of type UIntType.
void seed ()
 Initialization of the seed array. The call to the seed(5489) method is performed.
void seed (UIntType value)
 Initialization of the seed array from the value value. The seed array of this generator consists of n elements.
void seed (UIntType *state)
 Initialization of the seed array from the array state. state must be an array of n elements.
template<class Generator>
void seed (Generator &gen)
 Initialization of the seed array from the generator gen. gen is a class that must contain the () operator returning a value of type UIntType.
UIntType getState (Integer j)
 Method that returns the generator state for index j. The complete state of the generator is given by the values of index j between 0 and n (0 < j <= n).
result_type min () const
 min() returns the minimum possible value of a sequence.
result_type max () const
 max() returns the maximum possible value of a sequence.
result_type operator() ()
 Overriding the () operator which returns the pseudo random value of the generator. The generator state is modified.
bool operator== (const MersenneTwister &rhs) const
 Overriding the == operator.
bool operator!= (const MersenneTwister &rhs) const
 Overriding the != operator.

Static Public Member Functions

static bool validation (result_type v)
 Validation function (I don't really know what it is for!).

Static Public Attributes

static const Integer word_size = w
static const Integer state_size = n
static const Integer shift_size = m
static const Integer mask_bits = r
static const UIntType parameter_a = a
static const Integer output_u = u
static const Integer output_s = s
static const UIntType output_b = b
static const Integer output_t = t
static const UIntType output_c = c
static const Integer output_l = l
static const bool has_fixed_range = false

Private Member Functions

UIntType compute (UIntType index) const
 Private method that returns the generator state for index index.
void twist (Integer block)
 Implementation of the "twist" operation associated with the Mersenne Twister. The generator state is modified.

Private Attributes

UIntType x [2 *n]
Integer i

Detailed Description

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
class Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >

MersenneTwister class pattern.

It allows defining classes of Mersenne Twister type generators based on the parameters w,n,m,r,a,u s,b,t,c and l. The generated pseudo-random numbers are of type UIntType. The generation of these numbers is done by calling the () operator. The state of the generator is defined by a private member x[] of the class, which is a array of 2*n dimensions. The seed (initial state of the generator) can be initialized by calling the constructors or the various seed methods available.

Definition at line 47 of file MersenneTwister.h.

Member Typedef Documentation

◆ result_type

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
typedef UIntType Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::result_type

Definition at line 51 of file MersenneTwister.h.

Constructor & Destructor Documentation

◆ MersenneTwister() [1/4]

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::MersenneTwister ( )
inline

Constructor with seed initialization from the seed() method.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 75 of file MersenneTwister.h.

◆ MersenneTwister() [2/4]

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::MersenneTwister ( UIntType value)
inlineexplicit

Constructor with initialization of the seed array from the value value. The call to the seed(value) method is performed.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 86 of file MersenneTwister.h.

◆ MersenneTwister() [3/4]

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
template<class It>
Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::MersenneTwister ( It & first,
It last )
inline

Constructor with initialization of the seed array from the seed(first,last) method.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 100 of file MersenneTwister.h.

◆ MersenneTwister() [4/4]

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
template<class Generator>
Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::MersenneTwister ( Generator & gen)
inlineexplicit

Constructor with initialization of the seed array from the generator gen. gen must contain the () operator which must return a value of type UIntType.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 113 of file MersenneTwister.h.

Member Function Documentation

◆ compute()

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
UIntType Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::compute ( UIntType index) const
inlineprivate

Private method that returns the generator state for index index.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 282 of file MersenneTwister.h.

Referenced by Arcane::random::MersenneTwister< UInt32, 32, 351, 175, 19, 0xccab8ee7, 11, 7, 0x31b6ab00, 15, 0xffe50000, 17, 0xa37d3c92 >::operator==().

Here is the caller graph for this function:

◆ getState()

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
UIntType Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::getState ( Integer j)
inline

Method that returns the generator state for index j. The complete state of the generator is given by the values of index j between 0 and n (0 < j <= n).

Author
Patrick Rathouit
Date
28/07/2006

Definition at line 192 of file MersenneTwister.h.

◆ max()

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
result_type Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::max ( ) const
inline

max() returns the maximum possible value of a sequence.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 215 of file MersenneTwister.h.

◆ min()

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
result_type Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::min ( ) const
inline

min() returns the minimum possible value of a sequence.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 205 of file MersenneTwister.h.

◆ operator!=()

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
bool Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::operator!= ( const MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val > & rhs) const
inline

Overriding the != operator.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 265 of file MersenneTwister.h.

◆ operator()()

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::result_type Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::operator() ( )
inline

Overriding the () operator which returns the pseudo random value of the generator. The generator state is modified.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 356 of file MersenneTwister.h.

References twist().

Here is the call graph for this function:

◆ operator==()

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
bool Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::operator== ( const MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val > & rhs) const
inline

Overriding the == operator.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 248 of file MersenneTwister.h.

◆ seed() [1/4]

◆ seed() [2/4]

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
template<class Generator>
void Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::seed ( Generator & gen)
inline

Initialization of the seed array from the generator gen. gen is a class that must contain the () operator returning a value of type UIntType.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 172 of file MersenneTwister.h.

◆ seed() [3/4]

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
void Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::seed ( UIntType * state)
inline

Initialization of the seed array from the array state. state must be an array of n elements.

Author
Patrick Rathouit
Date
28/07/2006

Definition at line 155 of file MersenneTwister.h.

◆ seed() [4/4]

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
void Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::seed ( UIntType value)
inline

Initialization of the seed array from the value value. The seed array of this generator consists of n elements.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 135 of file MersenneTwister.h.

◆ twist()

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
void Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::twist ( Integer block)
private

Implementation of the "twist" operation associated with the Mersenne Twister. The generator state is modified.

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 313 of file MersenneTwister.h.

Referenced by operator()().

Here is the caller graph for this function:

◆ validation()

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
bool Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::validation ( result_type v)
inlinestatic

Validation function (I don't really know what it is for!).

Author
Patrick Rathouit (origin BOOST library)
Date
28/07/2006

Definition at line 238 of file MersenneTwister.h.

Member Data Documentation

◆ has_fixed_range

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const bool Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::has_fixed_range = false
static

Definition at line 64 of file MersenneTwister.h.

◆ i

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
Integer Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::i
private

Definition at line 299 of file MersenneTwister.h.

◆ mask_bits

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const Integer Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::mask_bits = r
static

Definition at line 55 of file MersenneTwister.h.

◆ output_b

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const UIntType Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::output_b = b
static

Definition at line 59 of file MersenneTwister.h.

◆ output_c

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const UIntType Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::output_c = c
static

Definition at line 61 of file MersenneTwister.h.

◆ output_l

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const Integer Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::output_l = l
static

Definition at line 62 of file MersenneTwister.h.

◆ output_s

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const Integer Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::output_s = s
static

Definition at line 58 of file MersenneTwister.h.

◆ output_t

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const Integer Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::output_t = t
static

Definition at line 60 of file MersenneTwister.h.

◆ output_u

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const Integer Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::output_u = u
static

Definition at line 57 of file MersenneTwister.h.

◆ parameter_a

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const UIntType Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::parameter_a = a
static

Definition at line 56 of file MersenneTwister.h.

◆ shift_size

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const Integer Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::shift_size = m
static

Definition at line 54 of file MersenneTwister.h.

◆ state_size

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const Integer Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::state_size = n
static

Definition at line 53 of file MersenneTwister.h.

◆ word_size

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
const Integer Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::word_size = w
static

Definition at line 52 of file MersenneTwister.h.

◆ x

template<class UIntType, Integer w, Integer n, Integer m, Integer r, UIntType a, Integer u, Integer s, UIntType b, Integer t, UIntType c, Integer l, UIntType val>
UIntType Arcane::random::MersenneTwister< UIntType, w, n, m, r, a, u, s, b, t, c, l, val >::x[2 *n]
private

Definition at line 298 of file MersenneTwister.h.


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