Mail Archives: djgpp/1998/09/23/11:39:02
On Tue, 22 Sep 1998, Nate Eldredge wrote:
> You don't say how it works incorrectly, but perhaps you mean the fact
> that it produces the same numbers every time. This is because you
> aren't seeding the random number generator. The numbers are actually
> generated as a series based on some initial value, and that value is the
> seed. You set it with `srand', typically once at the beginning of your
> program. The return value of `time(0)' is a good value to use.
Please note that this issue is now explained in the FAQ (section
22.22).
- Raw text -