SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MTRand Class Reference

#include <MersenneTwister.h>

Public Types

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

Public Member Functions

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

Static Public Member Functions

static uint32 hash (time_t t, clock_t c)
 

Protected Types

enum  { M = 397 }
 

Protected Member Functions

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

Protected Attributes

int left
 
uint32pNext
 
uint32 state [N]
 

Friends

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

Detailed Description

Definition at line 74 of file MersenneTwister.h.

Member Typedef Documentation

typedef unsigned long MTRand::uint32

Definition at line 77 of file MersenneTwister.h.

Member Enumeration Documentation

anonymous enum
Enumerator

Definition at line 79 of file MersenneTwister.h.

anonymous enum
Enumerator
SAVE 

Definition at line 80 of file MersenneTwister.h.

anonymous enum
protected
Enumerator

Definition at line 83 of file MersenneTwister.h.

Constructor & Destructor Documentation

MTRand::MTRand ( const uint32 oneSeed)
inline

Definition at line 143 of file MersenneTwister.h.

References seed().

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

Definition at line 146 of file MersenneTwister.h.

References seed().

MTRand::MTRand ( )
inline

Definition at line 149 of file MersenneTwister.h.

References seed().

Member Function Documentation

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

Definition at line 324 of file MersenneTwister.h.

Referenced by RandHelper::initRandGlobal(), and seed().

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

Definition at line 133 of file MersenneTwister.h.

Referenced by mixBits().

void MTRand::initialize ( const uint32  oneSeed)
inlineprotected

Definition at line 290 of file MersenneTwister.h.

References N, and state.

Referenced by seed().

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

Definition at line 360 of file MersenneTwister.h.

References left, N, pNext, and state.

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

Definition at line 134 of file MersenneTwister.h.

Referenced by mixBits().

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

Definition at line 135 of file MersenneTwister.h.

References hiBit(), and loBits().

Referenced by twist().

double MTRand::operator() ( )
inline

Definition at line 109 of file MersenneTwister.h.

References rand().

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

Definition at line 155 of file MersenneTwister.h.

References rand().

double MTRand::rand53 ( )
inline

Definition at line 170 of file MersenneTwister.h.

References randInt().

double MTRand::randDblExc ( )
inline

Definition at line 164 of file MersenneTwister.h.

References randInt().

Referenced by randDblExc(), and randNorm().

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

Definition at line 167 of file MersenneTwister.h.

References randDblExc().

double MTRand::randExc ( )
inline

Definition at line 158 of file MersenneTwister.h.

References randInt().

Referenced by RandHelper::rand(), randExc(), and randNorm().

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

Definition at line 161 of file MersenneTwister.h.

References randExc().

MTRand::uint32 MTRand::randInt ( )
inline

Definition at line 185 of file MersenneTwister.h.

References left, pNext, and reload().

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

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

Definition at line 201 of file MersenneTwister.h.

References randInt().

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

Definition at line 176 of file MersenneTwister.h.

References randDblExc(), and randExc().

void MTRand::reload ( )
inlineprotected

Definition at line 308 of file MersenneTwister.h.

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

Referenced by randInt(), and seed().

void MTRand::save ( uint32 saveArray) const
inline

Definition at line 350 of file MersenneTwister.h.

References left, N, and state.

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

Definition at line 229 of file MersenneTwister.h.

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

void MTRand::seed ( )
inline

Definition at line 266 of file MersenneTwister.h.

References hash(), and N.

Referenced by MTRand().

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

Definition at line 137 of file MersenneTwister.h.

References mixBits().

Referenced by reload().

Friends And Related Function Documentation

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

Definition at line 371 of file MersenneTwister.h.

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

Definition at line 380 of file MersenneTwister.h.

Field Documentation

int MTRand::left
protected

Definition at line 87 of file MersenneTwister.h.

Referenced by load(), operator<<(), operator>>(), randInt(), reload(), and save().

uint32* MTRand::pNext
protected

Definition at line 86 of file MersenneTwister.h.

Referenced by load(), operator>>(), randInt(), and reload().

uint32 MTRand::state[N]
protected

Definition at line 85 of file MersenneTwister.h.

Referenced by initialize(), load(), operator<<(), operator>>(), reload(), save(), and seed().


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