Public Member Functions | List of all members
Celartem::Random Class Reference

#include <cel_random.h>

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
inSeedSeed 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
inRandomA 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
nAn 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
inSeedSeed value.

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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo