wfmath 1.0.3
A math library for the Worldforge system.
WFMath::MTRand Class Reference
Collaboration diagram for WFMath::MTRand:

Public Types

typedef uint32_t uint32
 

Public Member Functions

 MTRand (uint32 oneSeed)
 
 MTRand (const uint32 bigSeed[], uint32 seedLength=state_size)
 
template<typename FloatT >
FloatT rand ()
 
double rand ()
 
double rand (const double &n)
 
uint32 randInt ()
 
uint32 randInt (uint32 n)
 
void seed ()
 
void seed (uint32 oneSeed)
 
void seed (const uint32 init_vector[], uint32 init_vector_length=state_size)
 
std::ostream & save (std::ostream &) const
 
std::istream & load (std::istream &)
 
template<>
float rand ()
 
template<>
double rand ()
 

Static Public Attributes

static const uint32 state_size = 624
 
static MTRand instance
 

Detailed Description

Definition at line 33 of file MersenneTwister.h.

Member Typedef Documentation

◆ uint32

typedef uint32_t WFMath::MTRand::uint32

Definition at line 35 of file MersenneTwister.h.

Constructor & Destructor Documentation

◆ MTRand() [1/3]

WFMath::MTRand::MTRand ( )
inline

Definition at line 77 of file MersenneTwister.h.

◆ MTRand() [2/3]

WFMath::MTRand::MTRand ( uint32  oneSeed)
inlineexplicit

Definition at line 69 of file MersenneTwister.h.

◆ MTRand() [3/3]

WFMath::MTRand::MTRand ( const uint32  bigSeed[],
uint32  seedLength = state_size 
)
inlineexplicit

Definition at line 73 of file MersenneTwister.h.

Member Function Documentation

◆ load()

std::istream & WFMath::MTRand::load ( std::istream &  istr)

Definition at line 214 of file randgen.cpp.

◆ rand() [1/4]

double WFMath::MTRand::rand ( )
inline

Definition at line 89 of file MersenneTwister.h.

◆ rand() [2/4]

template<>
float WFMath::MTRand::rand ( )
inline

Definition at line 82 of file MersenneTwister.h.

◆ rand() [3/4]

template<>
double WFMath::MTRand::rand ( )
inline

Definition at line 86 of file MersenneTwister.h.

◆ rand() [4/4]

double WFMath::MTRand::rand ( const double &  n)
inline

Definition at line 92 of file MersenneTwister.h.

◆ randInt() [1/2]

MTRand::uint32 WFMath::MTRand::randInt ( )

Definition at line 167 of file randgen.cpp.

◆ randInt() [2/2]

MTRand::uint32 WFMath::MTRand::randInt ( uint32  n)
inline

Definition at line 96 of file MersenneTwister.h.

◆ save()

std::ostream & WFMath::MTRand::save ( std::ostream &  ostr) const

Definition at line 204 of file randgen.cpp.

◆ seed() [1/3]

void WFMath::MTRand::seed ( )

Definition at line 111 of file randgen.cpp.

◆ seed() [2/3]

void WFMath::MTRand::seed ( const uint32  init_vector[],
uint32  init_vector_length = state_size 
)

Definition at line 142 of file randgen.cpp.

◆ seed() [3/3]

void WFMath::MTRand::seed ( uint32  oneSeed)

Definition at line 132 of file randgen.cpp.

Member Data Documentation

◆ instance

MTRand WFMath::MTRand::instance
static

Definition at line 61 of file MersenneTwister.h.

◆ state_size

const MTRand::uint32 WFMath::MTRand::state_size = 624
static

Definition at line 37 of file MersenneTwister.h.


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