MTToolBox  0.2.10
Public Member Functions
MTToolBox::Sequential< T > Class Template Reference

Counting down number generator. More...

#include <Sequential.hpp>

Inheritance diagram for MTToolBox::Sequential< T >:
MTToolBox::AbstractGenerator< T >

Public Member Functions

 Sequential ()
 Constructor. More...
 
 Sequential (T p_mask)
 Constructor with mask. More...
 
 Sequential (T p_mask, T seed)
 
 Sequential (Sequential< T > &src)
 
void seed (T value)
 initialize internal state More...
 
void reseed (T seed)
 
generate ()
 transit current internal state to next state and output a pseudo random number. More...
 
next ()
 
int bitSize () const
 Return bit size of internal state, i.e dimension of GF(2)-vector space. More...
 
- Public Member Functions inherited from MTToolBox::AbstractGenerator< T >
virtual ~AbstractGenerator ()
 Virtual destructor (always required) More...
 

Detailed Description

template<typename T>
class MTToolBox::Sequential< T >

Counting down number generator.

Template Parameters
Ttype of output, should be integer type

Constructor & Destructor Documentation

template<typename T>
MTToolBox::Sequential< T >::Sequential ( )
inline

Constructor.

template<typename T>
MTToolBox::Sequential< T >::Sequential ( p_mask)
inline

Constructor with mask.

Parameters
[in]p_maskp_mask and internal counter are exclusively or-ed when output time.
template<typename T>
MTToolBox::Sequential< T >::Sequential ( p_mask,
seed 
)
inline
template<typename T>
MTToolBox::Sequential< T >::Sequential ( Sequential< T > &  src)
inline

Member Function Documentation

template<typename T>
int MTToolBox::Sequential< T >::bitSize ( ) const
inlinevirtual

Return bit size of internal state, i.e dimension of GF(2)-vector space.

It will be Mersenne Exponent, when generator use incomplete array, like Mersenne Twister.

Returns
bit size of internal state

Implements MTToolBox::AbstractGenerator< T >.

template<typename T>
T MTToolBox::Sequential< T >::generate ( )
inlinevirtual

transit current internal state to next state and output a pseudo random number.

Returns
a pseudo random number

Implements MTToolBox::AbstractGenerator< T >.

References MTToolBox::Sequential< T >::next().

template<typename T>
T MTToolBox::Sequential< T >::next ( )
inline
template<typename T>
void MTToolBox::Sequential< T >::reseed ( seed)
inline
template<typename T>
void MTToolBox::Sequential< T >::seed ( value)
inlinevirtual

initialize internal state

Initialization function does not need to be a GF(2)-linear function, non-GF(2)-linear function will be suitable. But as far as MTToolBox concerned, initialization only need to assure that the internal state is not zero. When generator use incomplete array, like Mersenne Twister, really used part of array should be set non-zero.

Parameters
[in]valueseed of initialization

Implements MTToolBox::AbstractGenerator< T >.

References MTToolBox::Sequential< T >::reseed().

Referenced by MTToolBox::Sequential< T >::reseed(), and MTToolBox::Sequential< T >::Sequential().


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