Mail Archives: djgpp/1998/03/25/00:55:30
At 03:58 3/24/1998 -0500, DJ Delorie wrote:
>
>> What are the values of m,a, and c that random() uses? (I'm assuming
>> it's a linear congruential random number generator, if not, please let
>> me know). I've looked up both rand() and random() using info, but they
>> don't provide the specific formula.
>
>Read the source!
This is of course the right answer. I'll just amplify a bit:
`rand' is a LCRNG. `random' is significantly more complicated. I'm no expert
of numerical analysis, and in fact I don't understand `random' at all. (Not
that I've tried very hard :)
The appropriate source files, once you've unpacked the DJLSR package, are:
`rand': src/libc/ansi/stdlib/rand.c
`random': src/libc/compat/stdlib/random.c
Nate Eldredge
eldredge AT ap DOT net
- Raw text -