MTToolBox  0.2.10
Public Types | Public Member Functions
MTToolBox::AlgorithmBestBits< U, V > Class Template Reference

Algorithm which searches tempering parameters. More...

#include <AlgorithmBestBits.hpp>

Inheritance diagram for MTToolBox::AlgorithmBestBits< U, V >:
MTToolBox::AlgorithmTempering< U, V >

Public Types

typedef temper_params< U > tempp
 a class which keeps tempering parameters. More...
 

Public Member Functions

 AlgorithmBestBits (int out_bit_length, const int shift_values[], int param_num, int limit_v)
 
 ~AlgorithmBestBits ()
 A destructor. More...
 
int operator() (TemperingCalculatable< U, V > &rand, bool verbose=false)
 Search tempering parameters. More...
 
bool isLSBTempering () const
 Shows if tempering is from LSB. More...
 
- Public Member Functions inherited from MTToolBox::AlgorithmTempering< U, V >
virtual ~AlgorithmTempering ()
 Virtual destructor (always required) More...
 

Detailed Description

template<typename U, typename V = U>
class MTToolBox::AlgorithmBestBits< U, V >

Algorithm which searches tempering parameters.

An algorithm which searches tempering parameters which improve equi-distribution property of pseudo random number generator. This algorithm simulate the algorithm of Dynamic creator of Mersenne Twister.

Warning
If you could not get high dimension of equi-distribution after tempering using parameters got by this algorithm, you should consider changing the design of random number generation algorithm.
Template Parameters
Utype of output of pseudo random number generator. Should be unsigned type.
Vtype of output of parameter generator.

Member Typedef Documentation

template<typename U , typename V = U>
typedef temper_params<U> MTToolBox::AlgorithmBestBits< U, V >::tempp

a class which keeps tempering parameters.

Constructor & Destructor Documentation

template<typename U , typename V = U>
MTToolBox::AlgorithmBestBits< U, V >::AlgorithmBestBits ( int  out_bit_length,
const int  shift_values[],
int  param_num,
int  limit_v 
)
inline
Parameters
[in]out_bit_lengthBit length of tempering parameters. usually, this equals to bit length of an output.
[in]shift_valuesShift values corresponds to tempering parameter. Positive integers mean left shift and negative integers are not supported in current version.
[in]param_numNumber of tempering parameters. In MTDC, this is two. Do not specify numbers over 7. Test is only done for 2. Greater numbers will consume huge CPU time and huge memories.
[in]limit_vlimit of tempering bit. Each tempering parameters are searched for limit bit plus shift values of parameters following to the parameters. Greater limit will consume huge CPU time and huge memories.
template<typename U , typename V = U>
MTToolBox::AlgorithmBestBits< U, V >::~AlgorithmBestBits ( )
inline

A destructor.

Member Function Documentation

template<typename U , typename V = U>
bool MTToolBox::AlgorithmBestBits< U, V >::isLSBTempering ( ) const
inlinevirtual

Shows if tempering is from LSB.

Returns
Always false.

Reimplemented from MTToolBox::AlgorithmTempering< U, V >.

template<typename U , typename V = U>
int MTToolBox::AlgorithmBestBits< U, V >::operator() ( TemperingCalculatable< U, V > &  rand,
bool  verbose = false 
)
inlinevirtual

Search tempering parameters.

Generate tempering parameters and Calculate dimension of equi-distribution and then choose tempering parameters which gives high dimension of equi-distribution. Searched tempering parameters are set to the pseudo random number generator.

Parameters
[in,out]randA pseudo random number generator
[in]verboseA flag for printing redundant message
Returns
0 always zero

Implements MTToolBox::AlgorithmTempering< U, V >.

References MTToolBox::AbstractGenerator< U >::bitSize(), MTToolBox::TemperingCalculatable< U, V >::resetReverseOutput(), MTToolBox::TemperingCalculatable< U, V >::setTemperingPattern(), and MTToolBox::TemperingCalculatable< U, V >::setUpTempering().


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