Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

LsgRandom Struct Reference
[Utilities]

Pseudo random number generator. More...

#include <random.h>

Collaboration diagram for LsgRandom:

Collaboration graph
[legend]

Data Fields

LsgObject super
unsigned long int state [LSG_RANDOM_STATE_SIZE]
int i

Related Functions

(Note that these are not member functions.)

LsgRandomLsgRandom_create (unsigned long int seed)
void LsgRandom_init (LsgRandom *self, unsigned long int seed)
unsigned long int LsgRandom_generate (LsgRandom *self)
float LsgRandom_random (LsgRandom *self)
float LsgRandom_randomMax (LsgRandom *self, float limit)
float LsgRandom_randomError (LsgRandom *self)
float LsgRandom_randomRange (LsgRandom *self, float base, float error)

Detailed Description

Pseudo random number generator.

A pseudo random number generator utilizing the Mersenne Twister algorithm.

See also:
http://www.math.keio.ac.jp/~matumoto/emt.html


Friends And Related Function Documentation

LsgRandom * LsgRandom_create unsigned long int  seed  )  [related]
 

Allocate and initialize a new LsgRandom instance with the given seed value.

Parameters:
seed The seed value
Returns:
a new LsgRandom instance

void LsgRandom_init LsgRandom self,
unsigned long int  seed
[related]
 

Initialize the instance with a given seed.

Parameters:
self The instance variable
seed The seed value

unsigned long int LsgRandom_generate LsgRandom self  )  [related]
 

Return a random unsigned long int between 0 and MAX_ULONG inclusive.

Parameters:
self The instance variable
Returns:
a random value between 0 and MAX_ULONG

float LsgRandom_random LsgRandom self  )  [related]
 

Return a random float between 0.0 and 1.0 inclusive.

Parameters:
self The instance variable
Returns:
a random value between 0.0 and 1.0

float LsgRandom_randomMax LsgRandom self,
float  limit
[related]
 

Return a random float between 0.0 and a given maximal value (inclusive).

Parameters:
self The instance variable
self The highest allowed return value
Returns:
a random value between 0.0 and limit

float LsgRandom_randomError LsgRandom self  )  [related]
 

Return a random float between -1.0 and +1.0 inclusive.

Parameters:
self The instance variable
Returns:
a random value between -1.0 and +1.0

float LsgRandom_randomRange LsgRandom self,
float  base,
float  error
[related]
 

Return a random float from a given interval.

Parameters:
self The instance variable
base The center of the interval
error The maximum distance between the return value and base
Returns:
a random value from the interval [ base - error, base + error ]


The documentation for this struct was generated from the following file:
(c) 2003, by Enno Cramer
generated on 13 Jul 2003
lescegra - doxygen