Blender V2.61 - r43446
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends

MTRand Class Reference

#include <MERSENNETWISTER.h>

List of all members.

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=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)

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 72 of file MERSENNETWISTER.h.


Member Typedef Documentation

typedef unsigned long MTRand::uint32

Definition at line 75 of file MERSENNETWISTER.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
N 

Definition at line 77 of file MERSENNETWISTER.h.

anonymous enum
Enumerator:
SAVE 

Definition at line 78 of file MERSENNETWISTER.h.

anonymous enum [protected]
Enumerator:
M 

Definition at line 81 of file MERSENNETWISTER.h.


Constructor & Destructor Documentation

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

Definition at line 140 of file MERSENNETWISTER.h.

References seed().

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

Definition at line 143 of file MERSENNETWISTER.h.

References seed().

MTRand::MTRand ( ) [inline]

Definition at line 146 of file MERSENNETWISTER.h.

References seed().


Member Function Documentation

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

Definition at line 325 of file MERSENNETWISTER.h.

References i, p, and U.

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

Definition at line 129 of file MERSENNETWISTER.h.

Referenced by mixBits().

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

Definition at line 291 of file MERSENNETWISTER.h.

References i, N, and state.

Referenced by seed().

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

Definition at line 361 of file MERSENNETWISTER.h.

References i, left, N, pNext, and state.

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

Definition at line 130 of file MERSENNETWISTER.h.

Referenced by twist().

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

Definition at line 131 of file MERSENNETWISTER.h.

Referenced by mixBits().

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

Definition at line 132 of file MERSENNETWISTER.h.

References hiBit(), and loBits().

Referenced by twist().

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

Definition at line 107 of file MERSENNETWISTER.h.

References rand().

double MTRand::rand ( ) [inline]

Definition at line 149 of file MERSENNETWISTER.h.

References randInt().

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

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

Definition at line 152 of file MERSENNETWISTER.h.

References rand().

double MTRand::rand53 ( ) [inline]

Definition at line 167 of file MERSENNETWISTER.h.

References randInt().

double MTRand::randDblExc ( ) [inline]

Definition at line 161 of file MERSENNETWISTER.h.

References randInt().

Referenced by randDblExc(), and randNorm().

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

Definition at line 164 of file MERSENNETWISTER.h.

References randDblExc().

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

Definition at line 158 of file MERSENNETWISTER.h.

References randExc().

double MTRand::randExc ( ) [inline]

Definition at line 155 of file MERSENNETWISTER.h.

References randInt().

Referenced by randExc(), and randNorm().

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

Definition at line 198 of file MERSENNETWISTER.h.

References i, and randInt().

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

Definition at line 182 of file MERSENNETWISTER.h.

References left, pNext, and reload().

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

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

Definition at line 173 of file MERSENNETWISTER.h.

References cos(), log(), randDblExc(), randExc(), and sqrt().

Referenced by generateTile_WAVELET().

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

Definition at line 309 of file MERSENNETWISTER.h.

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

Referenced by randInt(), and seed().

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

Definition at line 351 of file MERSENNETWISTER.h.

References i, left, N, and state.

void MTRand::seed ( ) [inline]

Definition at line 262 of file MERSENNETWISTER.h.

Referenced by MTRand().

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

Definition at line 218 of file MERSENNETWISTER.h.

References initialize(), and reload().

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

Definition at line 226 of file MERSENNETWISTER.h.

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

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

Definition at line 134 of file MERSENNETWISTER.h.

References loBit(), and mixBits().

Referenced by reload().


Friends And Related Function Documentation

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

Definition at line 372 of file MERSENNETWISTER.h.

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

Definition at line 381 of file MERSENNETWISTER.h.


Member Data Documentation

int MTRand::left [protected]

Definition at line 85 of file MERSENNETWISTER.h.

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

uint32* MTRand::pNext [protected]

Definition at line 84 of file MERSENNETWISTER.h.

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

uint32 MTRand::state[N] [protected]

Definition at line 83 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: