Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Rand Class Reference

Provides radomization functionality. More...

#include <Random.hpp>

List of all members.

Static Public Member Functions

void saveState (unsigned long *mt, int &mti)
 Stores state information that can be reloaded later.

void loadState (unsigned long *mt, int mti)
 Loads state information that can be reloaded later.

void init_genrand (unsigned long s)
 Initializes mt[N] with a seed.

void init_by_array (unsigned long init_key[], int key_length)
 initialize by an array with array-length

unsigned long int32 (void)
 Generates a random number on [0,0xffffffff]-interval.

long int31 (void)
 Generates a random number on [0,0x7fffffff]-interval.

double real1 (void)
 Generates a random number on [0,1]-real-interval.

double real2 (void)
 Generates a random number on [0,1)-real-interval.

double real3 (void)
 Generates a random number on (0,1)-real-interval.

double res53 (void)
 Generates a random number on [0,1) with 53-bit resolution.


Static Private Attributes

unsigned long mt [RANDOM_ARRAY_SZ]
 The array for the state vector.

int mti = N+1
 mti==N+1 means mt[N] is not initialized


Detailed Description

Provides radomization functionality.

Internally, code based on Merseene Twister from http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html


Member Function Documentation

void Rand::saveState unsigned long *  mt,
int &  mti
[static]
 

Stores state information that can be reloaded later.

Parameters:
mt An array of N elements that where the state vector will be stored.
mti mti == N + 1 means mt[N] is not initialized.

void Rand::loadState unsigned long *  mt,
int  mti
[static]
 

Loads state information that can be reloaded later.

Parameters:
mt An array of N elements from which the state vector will be loaded.
mti mti == N + 1 means mt[N] is not initialized.

void Rand::init_genrand unsigned long  s  )  [static]
 

Initializes mt[N] with a seed.

Parameters:
s The seed.

void Rand::init_by_array unsigned long  init_key[],
int  key_length
[static]
 

initialize by an array with array-length

Parameters:
init_key The array for initializing keys.
key_length The length of the init_key.

unsigned long Rand::int32 void   )  [static]
 

Generates a random number on [0,0xffffffff]-interval.

Returns:
A random value on the interval.

long Rand::int31 void   )  [static]
 

Generates a random number on [0,0x7fffffff]-interval.

Returns:
A random value on the interval.

double Rand::real1 void   )  [static]
 

Generates a random number on [0,1]-real-interval.

Returns:
A random value on the interval.

double Rand::real2 void   )  [static]
 

Generates a random number on [0,1)-real-interval.

Returns:
A random value on the interval.

double Rand::real3 void   )  [static]
 

Generates a random number on (0,1)-real-interval.

Returns:
A random value on the interval.

double Rand::res53 void   )  [static]
 

Generates a random number on [0,1) with 53-bit resolution.

Returns:
A random value on the interval.


The documentation for this class was generated from the following files:
Generated on Fri Apr 22 13:47:45 2005 for PhoenixRising NDS Library by doxygen 1.3.6