Alternative Entropy Sources

前端 未结 15 641
情书的邮戳
情书的邮戳 2020-12-11 02:12

Okay, I guess this is entirely subjective and whatnot, but I was thinking about entropy sources for random number generators. It goes that most generators are seeded with th

相关标签:
15条回答
  • 2020-12-11 02:13

    Linux kernel uses device interrupt timing (mouse, keyboard, hard drives) to generate entropy. There's a nice article on Wikipedia on entropy.

    0 讨论(0)
  • 2020-12-11 02:14

    Source of seed isn't that much important. More important is the pseudo numbers generator algorithm. However I've heard some time ago about generating seed for some bank operations. They took many factors together:

    • time
    • processor temperature
    • fan speed
    • cpu voltage
    • I don't remember more :)

    Even if some of these parameters doesn't change much in time, you can put them into some good hashing function.

    How to generate good random number?

    Maybe we can take into account inifinite number of universes? If this is true, that all the time new parallel universes are being created, we can do something like this:

    int Random() {
        return Universe.object_id % MAX_INT;
    }
    

    In every moment we should be on another branch of parallel universes, so we should have different id. The only problem is how to get Universe object :)

    0 讨论(0)
  • 2020-12-11 02:15

    SGI once used photos of a lava lamp at various "glob phases" as the source for entropy, which eventually evolved into an open source random number generator called LavaRnd.

    0 讨论(0)
  • 2020-12-11 02:16

    Don't worry about a "good" seed for a random number generator. The statistical properties of the sequence do not depend on how the generator is seeded.

    I disagree with John D. Cook's advice. If you seed the Mersenne Twister with all bits set to zero except one, it will initially generate numbers which are anything but random. It takes a long time for the generator to churn this state into anything that would pass statistical tests. Simply setting the first 32 bits of the generator to a seed will have a similar effect. Also, if the entire state is set to zero the generator will produce endless zeroes.

    Properly written RNG code will have a properly written seeding algorithm that accepts say a 64 bit value and seeds the generator so it will produce decent random numbers for each possible input. So if you are using a reliable library then any seed will do. But if you hack together your own implementation then you need to be careful.

    0 讨论(0)
  • 2020-12-11 02:18

    I use Random.ORG, they provide free random data from Atmospheric noise, that I use to periodically re-seed a Mersene-Twister RNG. Its about as random as you can get with no hardware dependencies.

    0 讨论(0)
  • 2020-12-11 02:19

    Don't worry about a "good" seed for a random number generator. The statistical properties of the sequence do not depend on how the generator is seeded. There are other things, however. to worry about. See Pitfalls in Random Number Generation.

    As for hardware random number generators, these physical sources have to be measured, and the measurement process has systematic errors. You might find "pseudo" random numbers to have higher quality than "real" random numbers.

    0 讨论(0)
提交回复
热议问题