John Schutkeker <js****************@cs.com> wrote:

Does anybody know what pseudo-random number generator was used to implement

the RAN() function in the C standard math library?

There is no RAN() function in the C library (and if there were, that

all-caps name would be a bad idea). The Standard RNG function is called

rand(). rand() is not in the math library, nor in the maths headers, but

in <stdlib.h> and in "the" library. There is no required algorithm for

rand(); all it has to do is provide pseudo-random numbers.

Knuth couldn't have

gone so far as to implement a quadratic congruential method, right?

Knuth has nothing to do with the ISO C Standard library (unless he is on

the ISO C Committee, which I think he isn't, BICBW), and he certainly

has not implemented anything that can be called "the" Standard library.

All the Standard requires is that

- rand() returns a sequence of PRNs, between 0 to RAND_MAX inclusive;

- no library function shall call rand() (as far as the user can detect);

- RAND_MAX is at least 32767;

- srand() can be used to initialise rand()'s seed.

Nothing else is required. An example is given as to how rand() _could_

be implemented, but that's all it is: an example.

Richard