Random
Detailed Description
-
class
Random
: public RED::RNG Class providing a Mersenne Twister-based pseudo-random numbers generator.
@related class RED::FastRandom
As the built-in C/C++ pseudo-random numbers generator, this one has two methods: one for algorithm initialization (RED::Random::Init) and another one for getting 32bit numbers (RED::Random::Rand32). RED::Random::Max32 is the biggest number Rand32() can return.
This implementation is cross-platform and ensures users that the same numbers will be returned for a given seed on every machine run under any OS.
This generator is surely not the fastest one, but can be used as a reliable pseudo-random numbers generator for tasks which are not critic.
Public Functions
-
SET_CID (CID_class_REDRandom) IMPLEMENT_AS()
-
Random
(unsigned int iSeed = 24091975) Constructs a random numbers generator.
Parameters: iSeed – seed used for initialization.
-
virtual void
Init
(unsigned int iSeed) Initializes a 32bit pseudo-random numbers generator.
Parameters: iSeed – seed used for initialization.
-
virtual unsigned int
Rand32
() Returns: a 32bit pseudo-random number in the range [0, RED::Random::Max32-1].
-