Random Numbers ...

Doug Gwyn gwyn at brl-smoke.ARPA
Sun Feb 28 10:55:19 AEST 1988


In article <225800009 at uxe.cso.uiuc.edu> mcdonald at uxe.cso.uiuc.edu writes:
>Has anyone out there considered how to write a random number generator in
>which the output is truly random?

Yes, you need a truly random mechanism, such as a radiation counter or
resistive thermal noise (as you say you once did).  Deterministic
algorithms will of course always have intrinsic regularities.

>In my tests it seems that the low-order bits have a very short repetition
>period.  I've considered using two ordinary generators giving 32-bit periods
>and patching together the high order words. Is this better?

It depends on how you're using the pseudo-random sequence.  I suggest
you read Chapter 3 of Donald Knuth's "The Art of Computer Programming"
(in Volume 2, "Seminumerical Algorithms", 2nd ed., Addison-Wesley 1981,
ISBN 0-201-03822-6).



More information about the Comp.lang.c mailing list