delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/04/12:30:13

Message-Id: <2.2.32.19970604162434.0069d50c@gate>
Mime-Version: 1.0
Date: Wed, 04 Jun 1997 09:24:34 -0700
To: djgpp AT delorie DOT com
From: "Alan Wilson" <awilson AT wilshire DOT com>
Subject: Re: Random numbers/George

At 09:41 AM 6/4/97 +0200, you wrote:
>Eli Zaretskii wrote:
>> 
>> On 3 Jun 1997, George Foot wrote:
>> 
>> > Apparently, random() is a `more' random
>> > generator than rand(); presumably the reason the portable rand() function
>> > uses a worse generator is that the algorithm is specified in the standard,
>> > although I really don't know (does anyone?).
>> 
>> I think at least part of the reason for what `rand' does is that good
>> random generators are notoriously hard to invent, and those which
>> exist aren't always free.  DJGPP's libc needs to be totally free.
>
>Two other reasons: 
>
>- the algorithm used by random() has been less studied than the linear 
>congruential thing, which rand() uses. Thus, rand() has *known* strenth 
>and failures, while random() is a little more "murky", this may be a 
>problem when using random numbers for simulation.
>
>- rand() is much faster than random() 
>
>Anyway, I'd like to point out that if you need "informal" random numbers, 
>like in games, raytracers... rand() is probably more than enough. On the 
>contrary, if you need "really" random numbers, for statistics, Monte 
>Carlo integration and the like, then you'd better avoid using any 
>"canned" function like rand() or random(), and program your own (or, 
>rather, several) RNG, taken from an academic book, and with known 
>properties.
>
>Francois
>

It sounds like to me that DJGPP doesnt have a truly random generator then.
"Informal" random numbers are nice but it would be better if we could
generate truly random numbers where the frequency of all numbers were the
same...
Alan Wilson


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019