Public Member Functions

Celartem::Random Class Reference

#include <cel_random.h>

List of all members.

Public Member Functions

 Random ()
 Random (u32 inSeed)
 Random (const Random &inRandom)
void sgenrand (u32 seed)
double genrand ()
size_t genrand_n (size_t n)
u32 forward ()

Detailed Description

Pseudo random number generator based on Mersenne Twister Random Number Generator algorithm.


Constructor & Destructor Documentation

Celartem::Random::Random (  ) 

Initializes the random number generator using current tick count obtained by TimeUtils::getTick();

Celartem::Random::Random ( u32  inSeed  ) 

Initializes the random number generator using the specified seed.
This method internally calls sgenrand method.

Parameters:
inSeed Seed value.
Celartem::Random::Random ( const Random inRandom  ) 

Duplicates the existing Random instance.
The original and the duplicated instance generates same random numbers until sgenrand method is called.

Parameters:
inRandom A Random instance to duplicate.

Member Function Documentation

u32 Celartem::Random::forward (  ) 

Forward the state of the random number generator.

Returns:
Reserved for internal use. Usually it should be ignored.
double Celartem::Random::genrand (  ) 

Generates a fraction number in [0 1).

Returns:
A fraction number in [0 1); a number which is no less than 0 but smaller than 1.0.
size_t Celartem::Random::genrand_n ( size_t  n  ) 

Generates an integral number in [0 n).

Parameters:
n An integral number.
Returns:
An integral number in [0 n); a number which is no less than 0 but smaller than n.
void Celartem::Random::sgenrand ( u32  seed  ) 

Initializes the random number generator using the specified seed.

Parameters:
inSeed Seed value.

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

This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:18.
Caminova Logo