RNG

Fields

const unsigned int

Max32

Functions

CID

GetClassID

void *

As

const void *

As

class T_As

As

class T_As

As

void

Init

unsigned int

Rand32

double

RandD

Detailed Description

class RNG : public RED::Object

Abstract class providing an interface to random number generators.

@related class RED::Random, class RED::FastRandom

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.

Subclassed by RED::FastRandom, RED::Random

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
virtual void Init(unsigned int iSeed) = 0

Initializes a 32bit pseudo-random numbers generator.

Parameters

iSeed – seed used for initialization.

virtual unsigned int Rand32() = 0
Returns

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

double RandD()
Returns

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

Public Static Functions

static inline RED::CID GetClassID()

Public Static Attributes

static const unsigned int Max32

Maximum value returned by Rand32 + 1.