6 ms·
For "Arc4Random" it says "Reproducible Results: Not Always". Can an algorithm really produce a non-reproducible result?
by Tipewryter 6y ago
For "Arc4Random" it says "Reproducible Results: Not Always".
Can an algorithm really produce a non-reproducible result?
- stonogo 6y agoThere are implementations of Arc4Random which introduce entropy during generation. So, it's not a design feature of the algorithm as much as it is an implementation detail.
- jwilk 6y agohttps://www.pcg-random.org/other-rngs.html#arc4random https://www.pcg-random.org/other-rngs.html#arc4random explains what they meant: > The BSD implementations (which are the only widely used ones) have several additional issues > • No facility for a user-provided seed, preventing programs from getting reproducible results > • Periodically “stirs” the generator using kernel-provided entropy; this code must be removed if reproducible results desired (and is removed from the C++ adaptation I created for testing purposes)
- Thorrez 6y agoThanks for the info. I wonder why the openssl implementation wasn't used: https://stackoverflow.com/q/9329631/830749 https://stackoverflow.com/q/9329631/830749
- AlotOfReading 6y agoDepends on what you're counting for determinism. Arc4Random uses the system entropy pool, so it's non-deterministic from a user perspective. In a more direct sense, yes. If you're allowed to keep secrets (like internal state), it's possible to produce random numbers algorithmically for certain (weak) definitions of random, even with a deterministic machine. A simple example of this would be sequential bits of a normal number. As you strengthen your definition of randomness you pretty quickly get into non-computable territory though.