![]() ![]() ![]()
|
SophiaFramework UNIVERSE 5.3 |
The SFXLCGRandom class generates a 48-bit random number using the same algorithm as the drand48 function of UNIX.
The same sequence of random numbers will be generated from the same seed.
// if no seed is set, the elapsed time after the power is turned ON will become the seed SFXLCGRandom random; // generate a random number between SINT32_MINIMUM and SINT32_MAXIMUM SInt32 n1 = random.GetSInt32(); // set the seed random.Randomize(3456); // generate a random number between 0 and UINT08_MAXIMUM UInt08 n2 = random.GetUInt08();
| Constructor/Destructor |
|---|
|
SFXLCGRandom(
UInt32 seed = 0
) Constructor of the SFXLCGRandom class.
|
| Public Functions | |
|---|---|
| Bool |
GetBool( Void ) Generate a random number of Bool type.
|
| Float32 |
GetFloat32( Void ) Generate a random number of Float32 type.
|
| Float64 |
GetFloat64( Void ) Generate a random number of Float64 type.
|
| SInt08 |
GetSInt08( Void ) Generate a random number of SInt08 type.
|
| SInt16 |
GetSInt16( Void ) Generate a random number of SInt16 type.
|
| SInt32 |
GetSInt32( Void ) Generate a random number of SInt32 type.
|
| SInt64 |
GetSInt64( Void ) Generate a random number of SInt64 type.
|
| UInt08 |
GetUInt08( Void ) Generate a random number of UInt08 type.
|
| UInt16 |
GetUInt16( Void ) Generate a random number of UInt16 type.
|
| UInt32 |
GetUInt32( Void ) Generate a random number of UInt32 type.
|
| UInt64 |
GetUInt64( Void ) Generate a random number of UInt64 type.
|
| Void |
Randomize(
UInt32 seed = 0
) Set the seed for generating a random number.
|
[ public, explicit ]
SFXLCGRandom(
UInt32 seed = 0 // seed to generate a random number
);If 0 is set to the "seed" argument, a seed is automatically set up based on the elapsed time after the device is turned on. In case that time cannot be obtained, "0x1234ABCD" is set to this argument.
[ public ] Bool GetBool(Void);
Return the generated random number of Bool type.
Return the Bool-casted value of the 41th-from-lowest bit of a random number of unsigned 48-bit integer.
[ public ] Float32 GetFloat32(Void);
The return value takes the value from 0 to less than 1.
Return the Float32-casted value of the 24 bits of a random number of unsigned 48-bit integer divided by 16777216.
[ public ] Float64 GetFloat64(Void);
The return value takes the value from 0 to less than 1.
Return the Float64-casted value of a composition of the 26 or 27 bits of two random numbers of unsigned 48-bit integer divided by 9007199254740992.
[ public ] SInt08 GetSInt08(Void);
Return the SInt08-casted value of the highest 8 bits of a random number of unsigned 48-bit integer.
[ public ] SInt16 GetSInt16(Void);
Return the SInt16-casted value of the highest 16 bits of a random number of unsigned 48-bit integer.
[ public ] SInt32 GetSInt32(Void);
Return the SInt32-casted value of the highest 32 bits of a random number of unsigned 48-bit integer.
[ public ] SInt64 GetSInt64(Void);
Return the SInt64-casted value of the highest 32 bits of a random number of unsigned 48-bit integer.
[ public ] UInt08 GetUInt08(Void);
Return the UInt08-casted value of the highest 8 bits of a random number of unsigned 48-bit integer.
[ public ] UInt16 GetUInt16(Void);
Return the UInt16-casted value of the highest 16 bits of a random number of unsigned 48-bit integer.
[ public ] UInt32 GetUInt32(Void);
Return the UInt32-casted value of the highest 32 bits of a random number of unsigned 48-bit integer.
[ public ] UInt64 GetUInt64(Void);
Return the UInt64-casted value of the highest 32 bits of a random number of unsigned 48-bit integer.
If 0 is set to the "seed" argument, a seed is automatically set up based on the elapsed time after the device is turned on. In case that time cannot be obtained, "0x1234ABCD" is set to this argument.
|
Copyright(c) 2002 - 2012 Sophia Cradle Incorporated All Rights Reserved. |
![]() ![]() ![]()
|