Mail Archives: djgpp/1998/02/07/12:47:45
Paul Derbyshire wrote:
>
> Your best bet, actually, would be to use (random()>>4)%10, for instance,
> to discard the low four bits, which are usually less random than the rest
> of the pseudo-random number and which make this known when %ing by small
> quantities.
While DJGPP's rand() library function suffers from this problem,
random() uses a better algorithm that does not. This is an example of
why it's not a good idea to depend on built-in random number generators
if you are writing code that depends on having as much "randomness" as
possible.
--
---------------------------------------------------------------------
| John M. Aldrich | "If 'everybody knows' such-and-such, |
| aka Fighteer I | then it ain't so, by at least ten |
| mailto:fighteer AT cs DOT com | thousand to one." |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -