Message-ID: <37A0BAD7.3DB143DB@lycosmail.com> Date: Thu, 29 Jul 1999 16:34:32 -0400 From: Adam Schrotenboer X-Mailer: Mozilla 4.6 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: how about "more" random ? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > On Thu, 29 Jul 1999, Simon De Deyne wrote: > > > Thanks for the answer! I did consider this way, but then, > > i also noticed that the seeding with the time function (srand) isn't > > as random as when i used the other random function. > > Seed has nothing to do with randomness. > > > > So to produce a random number between 0 and 99 > > > x = rand() % 100; > > The low bits of the random numbers are known to be not very random. If > you want more random results, try this (untested!): > > x = ((double) rand ()) * 100 / RAND_MAX; Not exactly the correct method (IIRC), but close: x = ((double) rand ()/RAND_MAX) * 100;