John Van Pelt wrote:

> It's apparently hard -- maybe impossible -- to program 
> "perfect" randomness;

You are in good company with that assertion:

"Any one who considers arithmetical methods of producing random digits is, of 
course, in a state of sin."
--John von Neumann.

However, we've gone long beyond that.  Many OSes now use an 'entropy pool' 
which 
uses environmental inputs to generate a random data stream.  If that's not good 
enough for you, you can use a hardware device which relies on thermal noise and 
the hardcore cryptologists will use a radioactive decay source.  I'm guessing 
that this is the gold standard the folks at the _other_ NSA use--presumably 
they 
have no trouble getting their hands on spare bits of radioactive stuff.

Probably the semantics of the code Jason quoted depends on your libc/c++ 
implementation.

That said, I personally might prefer using a normalized floating point random 
number source instead of modulo arithmetic.  No perceptible difference for 
human-vs-computer games, but conceivably might bias results of simulations.
--gvc

Reply via email to