MTToolBox  0.2.10
Public Member Functions
MTToolBox::MersenneTwister Class Reference

Mersenne Twister pseudo random number generator. More...

#include <MersenneTwister.hpp>

Inheritance diagram for MTToolBox::MersenneTwister:
MTToolBox::AbstractGenerator< uint32_t >

Public Member Functions

 MersenneTwister ()
 Constructor without arguments. More...
 
 MersenneTwister (uint32_t value)
 Constructor with a integer seed. More...
 
 MersenneTwister (const std::string &value)
 Constructor with a string seed. More...
 
 MersenneTwister (const uint32_t *value, int size)
 Constructor with an array of integer. More...
 
 ~MersenneTwister ()
 Destructor. More...
 
void seed (uint32_t value)
 Initialization by 32-bit integer. More...
 
void seed (const std::string &value)
 Initialization by a string. More...
 
void seed (const uint32_t *value, int key_length)
 Initialization by an array of unsigned integers. More...
 
template<class T >
void seed_array (const T *value, int key_length)
 Initialization by an array of T type. More...
 
uint32_t generate ()
 Generates pseudo random number. More...
 
uint32_t next ()
 Generates pseudo random number. More...
 
int bitSize () const
 Returns 19937, which is size of internal state. More...
 
- Public Member Functions inherited from MTToolBox::AbstractGenerator< uint32_t >
virtual ~AbstractGenerator ()
 Virtual destructor (always required) More...
 

Detailed Description

Mersenne Twister pseudo random number generator.

Constructor & Destructor Documentation

MTToolBox::MersenneTwister::MersenneTwister ( )
inline

Constructor without arguments.

References seed().

MTToolBox::MersenneTwister::MersenneTwister ( uint32_t  value)
inline

Constructor with a integer seed.

Parameters
[in]valueSeed of initialization

References seed().

MTToolBox::MersenneTwister::MersenneTwister ( const std::string &  value)
inline

Constructor with a string seed.

Parameters
[in]valueSeed of initialization

References seed().

MTToolBox::MersenneTwister::MersenneTwister ( const uint32_t *  value,
int  size 
)
inline

Constructor with an array of integer.

Parameters
[in]valueSeed of initialization
[in]sizelength of value

References seed().

MTToolBox::MersenneTwister::~MersenneTwister ( )
inline

Destructor.

Member Function Documentation

int MTToolBox::MersenneTwister::bitSize ( ) const
inlinevirtual

Returns 19937, which is size of internal state.

Returns
Always 19937

Implements MTToolBox::AbstractGenerator< uint32_t >.

uint32_t MTToolBox::MersenneTwister::generate ( )
inlinevirtual

Generates pseudo random number.

Returns
a 32-bit unsigned integer

Implements MTToolBox::AbstractGenerator< uint32_t >.

References next().

uint32_t MTToolBox::MersenneTwister::next ( )
inline

Generates pseudo random number.

Returns
a 32-bit unsigned integer

Referenced by generate().

void MTToolBox::MersenneTwister::seed ( uint32_t  value)
inlinevirtual

Initialization by 32-bit integer.

Parameters
[in]valueSeed of initialization

Implements MTToolBox::AbstractGenerator< uint32_t >.

Referenced by MersenneTwister(), and seed_array().

void MTToolBox::MersenneTwister::seed ( const std::string &  value)
inline

Initialization by a string.

Parameters
[in]valueSeed of initialization
void MTToolBox::MersenneTwister::seed ( const uint32_t *  value,
int  key_length 
)
inline

Initialization by an array of unsigned integers.

Parameters
[in]valueSeed of initialization
[in]key_lengthLength of value
template<class T >
void MTToolBox::MersenneTwister::seed_array ( const T *  value,
int  key_length 
)
inline

Initialization by an array of T type.

Template Parameters
Ttype of element of value
Parameters
[in]valueSeed of initialization
key_lengthLength of value

References seed().


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