ODT
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
MTRand Class Reference

#include <MersenneTwister.h>

Public Types

enum  { N = 624 }
 
enum  { SAVE = N + 1 }
 
typedef unsigned long uint32
 

Public Member Functions

 MTRand (const uint32 &oneSeed)
 
 MTRand (uint32 *const bigSeed, uint32 const seedLength=N)
 
 MTRand ()
 
double rand ()
 
double rand (const double &n)
 
double randExc ()
 
double randExc (const double &n)
 
double randDblExc ()
 
double randDblExc (const double &n)
 
uint32 randInt ()
 
uint32 randInt (const uint32 &n)
 
double operator() ()
 
double rand53 ()
 
double randNorm (const double &mean=0.0, const double &variance=0.0)
 
void seed (const uint32 oneSeed)
 
void seed (uint32 *const bigSeed, const uint32 seedLength=N)
 
void seed ()
 
void save (uint32 *saveArray) const
 
void load (uint32 *const loadArray)
 

Protected Types

enum  { M = 397 }
 

Protected Member Functions

void initialize (const uint32 oneSeed)
 
void reload ()
 
uint32 hiBit (const uint32 &u) const
 
uint32 loBit (const uint32 &u) const
 
uint32 loBits (const uint32 &u) const
 
uint32 mixBits (const uint32 &u, const uint32 &v) const
 
uint32 twist (const uint32 &m, const uint32 &s0, const uint32 &s1) const
 

Static Protected Member Functions

static uint32 hash (time_t t, clock_t c)
 

Protected Attributes

uint32 state [N]
 
uint32pNext
 
int left
 

Friends

std::ostream & operator<< (std::ostream &os, const MTRand &mtrand)
 
std::istream & operator>> (std::istream &is, MTRand &mtrand)
 

Detailed Description

Definition at line 71 of file MersenneTwister.h.

Member Typedef Documentation

◆ uint32

typedef unsigned long MTRand::uint32

Definition at line 74 of file MersenneTwister.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator

Definition at line 76 of file MersenneTwister.h.

◆ anonymous enum

anonymous enum
Enumerator
SAVE 

Definition at line 77 of file MersenneTwister.h.

◆ anonymous enum

anonymous enum
protected
Enumerator

Definition at line 80 of file MersenneTwister.h.

Constructor & Destructor Documentation

◆ MTRand() [1/3]

MTRand::MTRand ( const uint32 & oneSeed)
inline

Definition at line 139 of file MersenneTwister.h.

◆ MTRand() [2/3]

MTRand::MTRand ( uint32 *const bigSeed,
uint32 const seedLength = N )
inline

Definition at line 142 of file MersenneTwister.h.

◆ MTRand() [3/3]

MTRand::MTRand ( )
inline

Definition at line 145 of file MersenneTwister.h.

Member Function Documentation

◆ hash()

MTRand::uint32 MTRand::hash ( time_t t,
clock_t c )
inlinestaticprotected

Definition at line 319 of file MersenneTwister.h.

◆ hiBit()

uint32 MTRand::hiBit ( const uint32 & u) const
inlineprotected

Definition at line 128 of file MersenneTwister.h.

◆ initialize()

void MTRand::initialize ( const uint32 oneSeed)
inlineprotected

Definition at line 285 of file MersenneTwister.h.

◆ load()

void MTRand::load ( uint32 *const loadArray)
inline

Definition at line 355 of file MersenneTwister.h.

◆ loBit()

uint32 MTRand::loBit ( const uint32 & u) const
inlineprotected

Definition at line 129 of file MersenneTwister.h.

◆ loBits()

uint32 MTRand::loBits ( const uint32 & u) const
inlineprotected

Definition at line 130 of file MersenneTwister.h.

◆ mixBits()

uint32 MTRand::mixBits ( const uint32 & u,
const uint32 & v ) const
inlineprotected

Definition at line 131 of file MersenneTwister.h.

◆ operator()()

double MTRand::operator() ( )
inline

Definition at line 106 of file MersenneTwister.h.

◆ rand() [1/2]

double MTRand::rand ( )
inline

Definition at line 148 of file MersenneTwister.h.

◆ rand() [2/2]

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

Definition at line 151 of file MersenneTwister.h.

◆ rand53()

double MTRand::rand53 ( )
inline

Definition at line 166 of file MersenneTwister.h.

◆ randDblExc() [1/2]

double MTRand::randDblExc ( )
inline

Definition at line 160 of file MersenneTwister.h.

◆ randDblExc() [2/2]

double MTRand::randDblExc ( const double & n)
inline

Definition at line 163 of file MersenneTwister.h.

◆ randExc() [1/2]

double MTRand::randExc ( )
inline

Definition at line 154 of file MersenneTwister.h.

◆ randExc() [2/2]

double MTRand::randExc ( const double & n)
inline

Definition at line 157 of file MersenneTwister.h.

◆ randInt() [1/2]

MTRand::uint32 MTRand::randInt ( )
inline

Definition at line 181 of file MersenneTwister.h.

◆ randInt() [2/2]

MTRand::uint32 MTRand::randInt ( const uint32 & n)
inline

Definition at line 197 of file MersenneTwister.h.

◆ randNorm()

double MTRand::randNorm ( const double & mean = 0.0,
const double & variance = 0.0 )
inline

Definition at line 172 of file MersenneTwister.h.

◆ reload()

void MTRand::reload ( )
inlineprotected

Definition at line 303 of file MersenneTwister.h.

◆ save()

void MTRand::save ( uint32 * saveArray) const
inline

Definition at line 345 of file MersenneTwister.h.

◆ seed() [1/3]

void MTRand::seed ( )
inline

Definition at line 261 of file MersenneTwister.h.

◆ seed() [2/3]

void MTRand::seed ( const uint32 oneSeed)
inline

Definition at line 217 of file MersenneTwister.h.

◆ seed() [3/3]

void MTRand::seed ( uint32 *const bigSeed,
const uint32 seedLength = N )
inline

Definition at line 225 of file MersenneTwister.h.

◆ twist()

uint32 MTRand::twist ( const uint32 & m,
const uint32 & s0,
const uint32 & s1 ) const
inlineprotected

Definition at line 133 of file MersenneTwister.h.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const MTRand & mtrand )
friend

Definition at line 366 of file MersenneTwister.h.

◆ operator>>

std::istream & operator>> ( std::istream & is,
MTRand & mtrand )
friend

Definition at line 375 of file MersenneTwister.h.

Member Data Documentation

◆ left

int MTRand::left
protected

Definition at line 84 of file MersenneTwister.h.

◆ pNext

uint32* MTRand::pNext
protected

Definition at line 83 of file MersenneTwister.h.

◆ state

uint32 MTRand::state[N]
protected

Definition at line 82 of file MersenneTwister.h.


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