Random

Functions

CID

GetClassID

void *

As

const void *

As

class T_As

As

class T_As

As

Random

void

Init

unsigned int

Rand32

Detailed Description

class Random : public RED::RNG

Class providing a Mersenne Twister-based pseudo-random numbers generator.

@related class RED::FastRandom

As the built-in C/C++ pseudo-random numbers generator, this one has two methods: one for algorithm initialization (RED::Random::Init) and another one for getting 32bit numbers (RED::Random::Rand32). RED::Random::Max32 is the biggest number Rand32() can return.

This implementation is cross-platform and ensures users that the same numbers will be returned for a given seed on every machine run under any OS.

This generator is surely not the fastest one, but can be used as a reliable pseudo-random numbers generator for tasks which are not critic.

Public Functions

virtual void *As(const RED::CID &iCID)

Converts the object to an instance of the given type.

Parameters

iCID – Requested class.

Returns

An object pointer of the given class on success, NULL otherwise.

virtual const void *As(const RED::CID &iCID) const

Converts the object to an instance of the given type.

Parameters

iCID – Requested class.

Returns

An object pointer of the given class on success, NULL otherwise.

template<class T_As>
inline T_As *As()
template<class T_As>
inline const T_As *As() const
Random(unsigned int iSeed = 24091975)

Constructs a random numbers generator.

Parameters

iSeed – seed used for initialization.

virtual void Init(unsigned int iSeed)

Initializes a 32bit pseudo-random numbers generator.

Parameters

iSeed – seed used for initialization.

virtual unsigned int Rand32()
Returns

a 32bit pseudo-random number in the range [0, RED::Random::Max32-1].

Public Static Functions

static inline RED::CID GetClassID()