include: co/random.h.
#Random
The Random
class is a very fast pseudo-random number generator, which can generate integers between 1 and 2G-2 continuously and without repetition.
#Random::Random
Random();
explicit Random(uint32_t seed);
- The default constructor uses 1 as the seed number, and the second constructor uses the parameter seed as the seed number.
#Random::next
uint32_t next();
-
Returns the next pseudo-random number, not thread safe. Once the seed number is determined, the random sequence generated by calling next() is completely determined.
-
Example
Random r(7);
int n = r.next();