Class SBDTypeRandom#
This class implements a random number generator. More...
#include <SBDTypeRandom.hpp>
Public Functions#
Type | Name |
---|---|
SBDTypeRandom () Constructs a random generator with fixed seed. |
|
SBDTypeRandom (unsigned long s) Constructs a random generator with custom seed. |
|
SB_DECLARE_DATA (SBDTypeRandom) |
|
double | randDouble1 () Generates a random number on [0,1]-real-interval. |
double | randDouble2 () Generates a random number on [0,1)-real-interval. |
double | randDouble3 () Generates a random number on (0,1)-real-interval. |
long | randLong () Generates a random number on [0,0x7fffffff]-interval. |
double | randRes53 () Generates a random number on [0,1) with 53-bit resolution. |
SBCContainerUUID | randUUID () Generates a random 32-character hexadecimal chain with the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. |
SBVector3 | randUnitSphere3 () Generates a point on the unit 3D sphere with uniform spherical distribution. |
unsigned long | randUnsignedLong () Generates a random number on [0,0xffffffff]-interval. |
void | seed (unsigned long s) Reseed the random generator. |
~SBDTypeRandom () Destructs the random generator. |
Protected Attributes#
Type | Name |
---|---|
SBDTypeRandomData * | dataPointer |
Detailed Description#
The class SBDTypeRandom generator implements the Mersenne Twister generator from the paper: M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Trans. on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3-30 (1998).
Note that the default constructor of SBDTypeRandom, SBDTypeRandom::SBDTypeRandom(), has a fixed seed. This is useful when debugging code, since it allows for reproducible results. For a "production run", though, a SBDTypeRandom object should be seeded with a random number, for example using SAMSON::getTime():
Short name: SBRandom
See also: SBUUID
Public Functions Documentation#
function SBDTypeRandom [1/2]#
Constructs a random generator with fixed seed.
function SBDTypeRandom [2/2]#
Constructs a random generator with custom seed.
function SB_DECLARE_DATA#
function randDouble1#
Generates a random number on [0,1]-real-interval.
function randDouble2#
Generates a random number on [0,1)-real-interval.
function randDouble3#
Generates a random number on (0,1)-real-interval.
function randLong#
Generates a random number on [0,0x7fffffff]-interval.
function randRes53#
Generates a random number on [0,1) with 53-bit resolution.
function randUUID#
Generates a random 32-character hexadecimal chain with the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
function randUnitSphere3#
Generates a point on the unit 3D sphere with uniform spherical distribution.
function randUnsignedLong#
Generates a random number on [0,0xffffffff]-interval.
function seed#
Reseed the random generator.
function ~SBDTypeRandom#
Destructs the random generator.