[Haskell-cafe] Just how unsafe is unsafe
Yitzchak Gale
gale at sefer.org
Sat Feb 7 20:24:11 EST 2009
Peter Verswyvelen wrote:
> I do have asked myself the question whether a "really random generating"
> function could be regarded as "pure" somehow
Not really. Somewhere in your program you are likely to make
the assumption that a value you obtained, however indirectly,
from this function will be the same in two different places.
But the sands will constantly be shifting.
Furthermore, in real life physical RNGs also involve state,
because they need to accumulate entropy. For example,
in Unix (on many platforms), the physical RNG device
/dev/random will block until there is enough entropy to
provide a random number. The /dev/urandom device
always returns a number immediately, but that is because
it will return a pseudo-random number if there is not enough
entropy available, again requiring state.
-Yitz
More information about the Haskell-Cafe
mailing list