| delorie.com/archives/browse.cgi | search |
| From: | ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Random numbers |
| Date: | 1 Jun 1997 06:26:36 GMT |
| Organization: | The National Capital FreeNet |
| Lines: | 18 |
| Message-ID: | <5mr4ms$ipp@freenet-news.carleton.ca> |
| References: | <01bc6ce9$72076bc0$363e63c3 AT 8652hvt73761> |
| Reply-To: | ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) |
| NNTP-Posting-Host: | freenet5.carleton.ca |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
For values of x not a power of 2,
random()%x
is not as good as
random()/(MAXINT/x)
Also, there's a name for a thousand million, "billion", which is somewhat
less long and awkward :)
--
.*. Where feelings are concerned, answers are rarely simple [GeneDeWeese]
-() < When I go to the theater, I always go straight to the "bag and mix"
`*' bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |