This class implements a random number generator. More...
Seed | |
SBDTypeRandomData * | dataPointer |
void | seed (unsigned long) |
Reseed the random generator. | |
SB_DECLARE_DATA (SBDTypeRandom) | |
Random integer generators | |
unsigned long | randUnsignedLong () |
Generates a random number on [0,0xffffffff]-interval. | |
long | randLong () |
Generates a random number on [0,0x7fffffff]-interval. | |
Random Universally Unique Identifier (UUID) generator | |
SBCContainerUUID | randUUID () |
Generates a random 32-character hexadecimal chain with the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. | |
Random vector generators | |
SBVector3 | randUnitSphere3 () |
Generates a point on the unit 3D sphere with uniform spherical distribution. | |
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