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]
int left


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

Member Typedef Documentation

typedef unsigned long MTRand::uint32

Member Enumeration Documentation

anonymous enum


anonymous enum


anonymous enum [protected]


Constructor & Destructor Documentation

MTRand::MTRand ( const uint32  oneSeed  )  [inline]

References seed().

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

References seed().

MTRand::MTRand (  )  [inline]

References seed().

MTRand::MTRand ( const MTRand o  )  [inline]

References left, N, pNext, and state.

Member Function Documentation

MTRand::uint32 MTRand::hash ( time_t  t,
clock_t  c 
) [inline, static, protected]

Referenced by seed().

uint32 MTRand::hiBit ( const uint32  u  )  const [inline, protected]

Referenced by mixBits().

void MTRand::initialize ( const uint32  oneSeed  )  [inline, protected]

References N, and state.

Referenced by seed().

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

References left, N, pNext, and state.

uint32 MTRand::loBit ( const uint32  u  )  const [inline, protected]

Referenced by magic().

uint32 MTRand::loBits ( const uint32  u  )  const [inline, protected]

Referenced by mixBits().

uint32 MTRand::magic ( const uint32  u  )  const [inline, protected]

References loBit().

Referenced by twist().

uint32 MTRand::mixBits ( const uint32  u,
const uint32  v 
) const [inline, protected]

References hiBit(), and loBits().

Referenced by twist().

double MTRand::operator() (  )  [inline]

References rand().

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

References left, N, pNext, and state.

double MTRand::rand ( const double  n  )  [inline]

References rand().

double MTRand::rand (  )  [inline]

References randInt().

Referenced by operator()(), rand(), and randNorm().

double MTRand::rand53 (  )  [inline]

References randInt().

double MTRand::randDblExc ( const double  n  )  [inline]

References randDblExc().

double MTRand::randDblExc (  )  [inline]

References randInt().

Referenced by randDblExc(), and utils::DRandom::random().

double MTRand::randExc ( const double  n  )  [inline]

References randExc().

double MTRand::randExc (  )  [inline]

References randInt().

Referenced by randExc().

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

References randInt().

MTRand::uint32 MTRand::randInt (  )  [inline]

References left, pNext, and reload().

Referenced by rand(), rand53(), randDblExc(), randExc(), and randInt().

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

References rand().

void MTRand::reload (  )  [inline, protected]

References left, M, N, pNext, state, and twist().

Referenced by randInt(), and seed().

void MTRand::save ( uint32 saveArray  )  const [inline]

References left, N, and state.

void MTRand::seed (  )  [inline]

References hash(), and N.

Referenced by MTRand().

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

References initialize(), N, reload(), and state.

void MTRand::seed ( const uint32  oneSeed  )  [inline]

References initialize(), and reload().

Referenced by utils::DRandom::changeSeed().

uint32 MTRand::twist ( const uint32  m,
const uint32  s0,
const uint32  s1 
) const [inline, protected]

References magic(), and mixBits().

Referenced by reload().

Friends And Related Function Documentation

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

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

Field Documentation

int MTRand::left [protected]

uint32* MTRand::pNext [protected]

uint32 MTRand::state[N] [protected]

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

Generated on Fri Jun 11 21:02:36 2010 for libdnstd by  doxygen