Mail Archives: djgpp/1997/06/04/12:30:13
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 -