Do stateless random number generators exist?

前端 未结 10 2022
孤街浪徒
孤街浪徒 2020-11-29 10:12

Is there a difference between generating multiple numbers using a single random number generator (RNG) versus generating one number per generator and discarding it? Do both

10条回答
  •  被撕碎了的回忆
    2020-11-29 10:37

    Hardware-based, true [1], random number generators are possible, but non-trivial and often have low mean rates. Availablity can also be an issue [2]. Googling for "shot noise" or "radioactive decay" in combination with "random number generator" should return some hits.

    These systems do not need to maintain state. Probably not what you were looking for.

    As noted by others, software systems are only pseudo-random, and must maintain state.

    A compromise is to use a hardware based RNG to provide an entropy pool (stored state) which is made available to seed a PRNG. This is done quite explicitly in the linux implementation of /dev/random [3] and /dev/urandom [4].

    These is some argument about just how random the default inputs to the /dev/random entropy pool really are.


    Footnotes:

    1. modulo any problems with our understanding of physics
    2. because you're waiting for a random process
    3. /dev/random features direct access to the entropy pool seeded from various sources believed to be really or nearly random, and blocks when the entropy is exhausted
    4. /dev/urandom is like /dev/random, but when the entopy is exhausted a cryptographic hash is employed which makes the entropy pool effectively a stateful PRNG

提交回复
热议问题