SophiaFramework UNIVERSE 5.3 |
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.
// 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);
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.
|
[ public, static ] Bool GetBool(Void);
Return the Bool-casted value of the lowest bit of a random number of UInt08 type.
SFXBrewRandom::GetBool();
[ public, static ] Float32 GetFloat32(Void);
The return value takes the value from 0 to less than 1.
Return the Float32-casted value of the lowest 24 bits of a random number of UInt32 type divided by 16777216.
SFXBrewRandom::GetFloat32();
[ public, static ] Float64 GetFloat64(Void);
The return value takes the value from 0 to less than 1.
Return the Float64-casted value of the lowest 53 bits of a random number of UInt64 type divided by 9007199254740992.
SFXBrewRandom::GetFloat64();
[ public, static ] SInt08 GetSInt08(Void);
Return the SInt08-casted value of a random number of UInt08 type.
SFXBrewRandom::GetSInt08();
[ public, static ] SInt16 GetSInt16(Void);
Return the SInt16-casted value of a random number of UInt16 type.
SFXBrewRandom::GetSInt16();
[ public, static ] SInt32 GetSInt32(Void);
Return the SInt32-casted value of a random number of UInt32 type.
SFXBrewRandom::GetSInt32();
[ public, static ] SInt64 GetSInt64(Void);
Return the SInt64-casted value of a random number of UInt64 type.
SFXBrewRandom::GetSInt64();
[ public, static ] UInt08 GetUInt08(Void);
Return a random number of UInt08 type.
SFXBrewRandom::GetUInt08();
[ public, static ] UInt16 GetUInt16(Void);
Return a random number of UInt16 type.
SFXBrewRandom::GetUInt16();
[ public, static ] UInt32 GetUInt32(Void);
Return a random number of UInt32 type.
SFXBrewRandom::GetUInt32();
[ public, static ] UInt64 GetUInt64(Void);
Return a random number of UInt64 type.
SFXBrewRandom::GetUInt64();
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |