D Programming Language 2.0

- Comments
- D
- Search
- Home

Last update Fri Oct 5 00:07:37 2007

# std.random

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().
  Note:
  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.
  BUGS:
  shares a global single state, not multithreaded

Copyright © 1999-2007 by Digital Mars, All Rights Reserved | Page generated by Ddoc.