Date: Wed, 23 Sep 1998 15:06:54 +0300 (IDT) From: Eli Zaretskii To: Nate Eldredge cc: Paul Minerva , djgpp AT delorie DOT com Subject: Re: problem with rand() In-Reply-To: <360835F0.4750F448@cartsys.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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).