Which is more random: human- or software-generated number?

前端 未结 7 1330
温柔的废话
温柔的废话 2021-01-13 12:16

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

7条回答
  •  花落未央
    2021-01-13 13:06

    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.

提交回复
热议问题