D Programming Language 1.0

Last update Mon Dec 31 10:53:28 2012



void rand_seed(uint seed, uint index);
The random number generator is seeded at program startup with a random value. This ensures that each program generates a different sequence of random numbers. To generate a repeatable sequence, use rand_seed() to start the sequence. seed and index start it, and each successive value increments index. This means that the nth random number of the sequence can be directly generated by passing index + n to rand_seed().

This is more random, but slower, than C's rand() function. To use C's rand() instead, import std.c.stdlib.

uint rand();
Get the next random number in sequence.

shares a global single state, not multithreaded