Click to See Complete Forum and Search --> : The run-time library rand() function


Brendan Cullen
April 30th, 1999, 05:04 AM
Hi,

Anybody got any idea what algorithm is used by the random number generator ?

Thanks,

Brendan

April 30th, 1999, 07:30 AM
Have a look at the code. It's in the CRT\SRC subdirectory.

Brendan Cullen
April 30th, 1999, 07:53 AM
Hi,

I don't have a CRT/SRC directory !!! What's the full path of yours ?

Brendan

Troy T
April 30th, 1999, 02:14 PM
When you installed VC did you include all of the MFC source, the debug code, etc?? If not, you may want to go add those, then you will have the directory! :)

- Troy

Jerry Coffin
April 30th, 1999, 09:50 PM
Glancing at the source code, it's a 32-bit linear-congruential generator with a multiplier of 214013 and an addend of 2531011. It returns only the top 16 bits generated.



The universe is a figment of its own imagination.

Orion Mazzor
May 1st, 1999, 02:34 PM
There is a book that talks about random number generators that you might find interesting called Advanced C (Second Edition) from Osborne McGraw-Hill. ISBN 0-07-881348-4.

Brendan Cullen
May 4th, 1999, 02:23 AM
Thanks Orion,

Brendan

Brendan Cullen
May 4th, 1999, 02:25 AM
Thanks Jerry,

Brendan

Brendan Cullen
May 4th, 1999, 02:25 AM
Thanks Troy,

Brendan