Does it toss a coin to get random bit?
Or throw a die to get a random integer from 1 to 6?
Or take a car
This is linux-specific but there is some OS support for "real" randomness: /dev/random
and /dev/urandom
. You read these like normal files.
random
is real randomness gleaned from physical processes such as irregular latencies in the hardware -- it is depleted when you read it and is cryptographically secure.
urandom
is a limitless pseudorandom source which is derived from random
and almost certainly higher quality than your C library PRNG.