delorie.com/archives/browse.cgi | search |
Date: | Mon, 1 Feb 1999 13:06:58 +0200 (IST) |
From: | Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> |
X-Sender: | eliz AT is |
To: | Rehammar <rehammar AT telia DOT com> |
cc: | djgpp AT delorie DOT com |
Subject: | Re: random |
In-Reply-To: | <36b4bcff.0@d2o25.telia.com> |
Message-ID: | <Pine.SUN.3.91.990201130503.14737A-100000@is> |
MIME-Version: | 1.0 |
Reply-To: | djgpp AT delorie DOT com |
On Sun, 31 Jan 1999, Rehammar wrote: > a=range*(float)random()/(float)RAND_MAX; > > but I didn't likt the way of doing it, is there no other way ?? The other way is to say "random()%(range - 1)" (assuming `range' is an int), but that might yield less random results, as lower bits returned by RNGs are usually not-so-random. What's wrong with what you did in the first place, anyway?
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |