www.delorie.com/archives/browse.cgi | search |
Date: | Thu, 29 Jul 1999 19:05:58 +0300 (IDT) |
From: | Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> |
X-Sender: | eliz AT is |
To: | Simon De Deyne <sdedeyne AT online DOT be> |
cc: | djgpp AT delorie DOT com |
Subject: | Re: how about "more" random ? |
In-Reply-To: | <7np18t$nj5$1@trex.antw.online.be> |
Message-ID: | <Pine.SUN.3.91.990729190414.27831B-100000@is> |
MIME-Version: | 1.0 |
Reply-To: | djgpp AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
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;
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |