class RED::FastRandom

Class providing a xorshift-based pseudo-random numbers generator. More...

#include <REDRandom.h>

Inherits: RNG.

Public functions:

FastRandom ( unsigned int iSeed = 24091975 )
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 )
virtual unsigned intRand32 ( )

Public static functions:

static RED::CIDGetClassID ( )

Private variables:

unsigned int_x

Detailed description:

Class providing a xorshift-based pseudo-random numbers generator.

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 intended to be very fast for random numbers generation when very good statistics performances are not the key.

Functions documentation

public RED::FastRandom::FastRandom(unsigned intiSeed = 24091975)

Constructs a random numbers generator.

Parameters:

iSeed:seed used for initialization.

Reimplements: RED::RNG::GetClassID.

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

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

template< class T_As > public const T_As * RED::FastRandom::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::RNG::As.

template< class T_As > public T_As * RED::FastRandom::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::RNG::As.

public virtual void RED::FastRandom::Init(unsigned intiSeed)

Initializes a 32bit pseudo-random numbers generator.

Parameters:

iSeed:seed used for initialization.

Implements: RED::RNG::Init.

public virtual unsigned int RED::FastRandom::Rand32()

Returns:

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

Implements: RED::RNG::Rand32.

Variables documentation

private unsigned int RED::FastRandom::_x

call me x.