Random Numbers
VLD/VMB
gwyn at BRL.ARPA
Sun Jul 21 13:49:12 AEST 1985
You are right -- there is no way to generate "really" random
numbers in a deterministic manner. Indeed, defining what is
meant by "random number" is not easy. The classic reference
for these matters is Donald Kunth's "The Art of Computer
Programming, Vol. 2: Seminumerical Algorithms", 2nd. Ed.
(Addison-Wesley, 1981).
Most people in practice use a library function like rand()
and "seed" it (via srand()) with a number unique to the
process invocation, such as the XOR of the time-of-day and
the process ID. Be warned that most implementations of
rand() do not generate very good random sequences!
More information about the Comp.lang.c
mailing list