PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFXBrewRandom
Class which generates a random number using the random number generation function of BREW API.
#include <SFXBrewRandom.h.hpp>
class SFXBrewRandom;
SFMTYPEDEFCLASS(SFXBrewRandom)

Description

The SFXBrewRandom class generates a random number using the random number generation function of BREW API.

This class internally calls the BREW API GETRAND function to generate a random number.

For each numeric data type such as Bool, Float32, Float 64, SInt08, SInt16, SInt32, UInt08, UInt16 or UInt32, there is the corresponding random number generation functions

For the minimum and the maximum of random number that each function can generate, see Macro for Maximum and Minimum Values.

Example

// generate a random number between SINT32_MINIMUM and SINT32_MAXIMUM
SInt32 n1 = SFXBrewRandom::GetSInt32(); 

// generate a random number between 0 and UINT08_MAXIMUM
UInt08 n2 = SFXBrewRandom::GetUInt08(); 

// generate a random number of Float64
Float64 n3 = SFXBrewRandom::GetFloat64(); 

// generate a random number of Bool type
Bool b = SFXBrewRandom::GetBool();       
// this method generates a random numbers of higher quality than the below
// Bool b = static_cast<Bool>(SFXBrewRandom::GetUInt32() % 2);

Reference

SFXLCGRandom | SFXMTRandom | BREW API GETRAND

Member

Public Functions
static
Bool
GetBool( Void )
Generate a random number of Bool type.
static
Float32
GetFloat32( Void )
Generate a random number of Float32 type.
static
Float64
GetFloat64( Void )
Generate a random number of Float64 type.
static
SInt08
GetSInt08( Void )
Generate a random number of SInt08 type.
static
SInt16
GetSInt16( Void )
Generate a random number of SInt16 type.
static
SInt32
GetSInt32( Void )
Generate a random number of SInt32 type.
static
SInt64
GetSInt64( Void )
Generate a random number of SInt64 type.
static
UInt08
GetUInt08( Void )
Generate a random number of UInt08 type.
static
UInt16
GetUInt16( Void )
Generate a random number of UInt16 type.
static
UInt32
GetUInt32( Void )
Generate a random number of UInt32 type.
static
UInt64
GetUInt64( Void )
Generate a random number of UInt64 type.

SFXBrewRandom::GetBool
Generate a random number of Bool type.
[ public, static ]
Bool GetBool(Void);

Description

Return the Bool-casted value of the lowest bit of a random number of UInt08 type.

Example

SFXBrewRandom::GetBool();

SFXBrewRandom::GetFloat32
Generate a random number of Float32 type.
[ public, static ]
Float32 GetFloat32(Void);

Return value

The return value takes the value from 0 to less than 1.

Description

Return the Float32-casted value of the lowest 24 bits of a random number of UInt32 type divided by 16777216.

Example

SFXBrewRandom::GetFloat32();

SFXBrewRandom::GetFloat64
Generate a random number of Float64 type.
[ public, static ]
Float64 GetFloat64(Void);

Return value

The return value takes the value from 0 to less than 1.

Description

Return the Float64-casted value of the lowest 53 bits of a random number of UInt64 type divided by 9007199254740992.

Example

SFXBrewRandom::GetFloat64();

SFXBrewRandom::GetSInt08
Generate a random number of SInt08 type.
[ public, static ]
SInt08 GetSInt08(Void);

Description

Return the SInt08-casted value of a random number of UInt08 type.

Example

SFXBrewRandom::GetSInt08();

SFXBrewRandom::GetSInt16
Generate a random number of SInt16 type.
[ public, static ]
SInt16 GetSInt16(Void);

Description

Return the SInt16-casted value of a random number of UInt16 type.

Example

SFXBrewRandom::GetSInt16();

SFXBrewRandom::GetSInt32
Generate a random number of SInt32 type.
[ public, static ]
SInt32 GetSInt32(Void);

Description

Return the SInt32-casted value of a random number of UInt32 type.

Example

SFXBrewRandom::GetSInt32();

SFXBrewRandom::GetSInt64
Generate a random number of SInt64 type.
[ public, static ]
SInt64 GetSInt64(Void);

Description

Return the SInt64-casted value of a random number of UInt64 type.

Example

SFXBrewRandom::GetSInt64();

SFXBrewRandom::GetUInt08
Generate a random number of UInt08 type.
[ public, static ]
UInt08 GetUInt08(Void);

Description

Return a random number of UInt08 type.

Example

SFXBrewRandom::GetUInt08();

SFXBrewRandom::GetUInt16
Generate a random number of UInt16 type.
[ public, static ]
UInt16 GetUInt16(Void);

Description

Return a random number of UInt16 type.

Example

SFXBrewRandom::GetUInt16();

SFXBrewRandom::GetUInt32
Generate a random number of UInt32 type.
[ public, static ]
UInt32 GetUInt32(Void);

Description

Return a random number of UInt32 type.

Example

SFXBrewRandom::GetUInt32();

SFXBrewRandom::GetUInt64
Generate a random number of UInt64 type.
[ public, static ]
UInt64 GetUInt64(Void);

Description

Return a random number of UInt64 type.

Example

SFXBrewRandom::GetUInt64();