iLand
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 ()
 
 MTRand (const MTRand &o)
 
uint32 randInt ()
 
uint32 randInt (const uint32 n)
 
double rand ()
 
double rand (const double n)
 
double randExc ()
 
double randExc (const double n)
 
double randDblExc ()
 
double randDblExc (const double n)
 
double operator() ()
 
double rand53 ()
 
double randNorm (const double mean=0.0, const double stddev=1.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)
 
MTRandoperator= (const MTRand &o)
 

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 magic (const uint32 u) 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)
 

Member Typedef Documentation

◆ uint32

typedef unsigned long MTRand::uint32

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator

◆ anonymous enum

anonymous enum
Enumerator
SAVE 

◆ anonymous enum

anonymous enum
protected
Enumerator

Constructor & Destructor Documentation

◆ MTRand() [1/4]

MTRand::MTRand ( const uint32  oneSeed)
inline

◆ MTRand() [2/4]

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

◆ MTRand() [3/4]

MTRand::MTRand ( )
inline

◆ MTRand() [4/4]

MTRand::MTRand ( const MTRand o)
inline

Member Function Documentation

◆ hash()

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

◆ hiBit()

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

◆ initialize()

void MTRand::initialize ( const uint32  oneSeed)
inlineprotected

◆ load()

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

◆ loBit()

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

◆ loBits()

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

◆ magic()

uint32 MTRand::magic ( const uint32  u) const
inlineprotected

◆ mixBits()

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

◆ operator()()

double MTRand::operator() ( )
inline

◆ operator=()

MTRand & MTRand::operator= ( const MTRand o)
inline

◆ rand() [1/2]

double MTRand::rand ( )
inline

◆ rand() [2/2]

double MTRand::rand ( const double  n)
inline

◆ rand53()

double MTRand::rand53 ( )
inline

◆ randDblExc() [1/2]

double MTRand::randDblExc ( )
inline

◆ randDblExc() [2/2]

double MTRand::randDblExc ( const double  n)
inline

◆ randExc() [1/2]

double MTRand::randExc ( )
inline

◆ randExc() [2/2]

double MTRand::randExc ( const double  n)
inline

◆ randInt() [1/2]

MTRand::uint32 MTRand::randInt ( )
inline

◆ randInt() [2/2]

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

◆ randNorm()

double MTRand::randNorm ( const double  mean = 0.0,
const double  stddev = 1.0 
)
inline

◆ reload()

void MTRand::reload ( )
inlineprotected

◆ save()

void MTRand::save ( uint32 saveArray) const
inline

◆ seed() [1/3]

void MTRand::seed ( )
inline

◆ seed() [2/3]

void MTRand::seed ( const uint32  oneSeed)
inline

◆ seed() [3/3]

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

◆ twist()

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

Friends And Related Function Documentation

◆ operator<<

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

◆ operator>>

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

Member Data Documentation

◆ left

int MTRand::left
protected

◆ pNext

uint32* MTRand::pNext
protected

◆ state

uint32 MTRand::state[N]
protected

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