class RED::RNG

Abstract class providing an interface to random number generators. More...

#include <REDRandom.h>

Inherits: Object.

Inherited by: FastRandom and Random.

Public functions:

virtual void *As ( const RED::CID & iCID )
virtual const void *As ( const RED::CID & iCID ) const
template< class T_As > const T_As *As ( ) const
template< class T_As > T_As *As ( )
virtual voidInit ( unsigned int iSeed ) = 0
virtual unsigned intRand32 ( ) = 0
doubleRandD ( )

Public static functions:

static RED::CIDGetClassID ( )

Public static variables:

static const unsigned intMax32

Detailed description:

Abstract class providing an interface to random number generators.

REDsdk makes an extensive use of random numbers. As a consequence REDsdk provides several random number generators for dedicated usages. Each generator inherits this class.

Functions documentation

public virtual void * RED::RNG::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.

Reimplements: RED::Object::As.

Reimplemented by: RED::FastRandom::As and RED::Random::As.

public virtual const void * RED::RNG::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.

Reimplements: RED::Object::As.

Reimplemented by: RED::FastRandom::As and RED::Random::As.

template< class T_As > public const T_As * RED::RNG::As() const

Template version of the as const method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to a const instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

Reimplemented by: RED::FastRandom::As and RED::Random::As.

template< class T_As > public T_As * RED::RNG::As()

Template version of the as method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

Reimplemented by: RED::FastRandom::As and RED::Random::As.

public virtual void RED::RNG::Init(unsigned intiSeed) = 0

Initializes a 32bit pseudo-random numbers generator.

Parameters:

iSeed:seed used for initialization.

Implemented by: RED::FastRandom::Init and RED::Random::Init.

public virtual unsigned int RED::RNG::Rand32() = 0

Returns:

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

Implemented by: RED::FastRandom::Rand32 and RED::Random::Rand32.

public double RED::RNG::RandD()

Returns:

A pseudo-random number in the rang [ 0.0, 1.0 ].

Variables documentation

public static const unsigned int RED::RNG::Max32

Maximum value returned by Rand32 + 1.