This repository contains benchmarks of various Pseudo Random Number Generators.
- FSR
- MWC
- MWCP MWC with output permutation
- SFC
- SFCK slightly modified SFC
- WYR slightly modified WYRand
- Odin based on PCG (could not find exact PCG)
- XoShiRo and XoRoShiRo: Not a fan, will put results at some point.
- Randomness: How random the PRNG appears to be.
- Predictability: How hard to predict future PRNG values given X consecutive values (assuming the PRNG used is known).
- Speed: How quickly the PRNG produces random numbers.
- Size: How much space is required to store the PRNG state.
- Applicability: Where the PRNG shines.
Randomness is measured by how many outputs does the testing software need to detect a statistical improbability. The software used is PractRand (to my knowleadge ammong the best, and at the same time the most pleasent to use). Used PractRand settings are Extended + Max Fold (the most rigorous)
Probably scales worse than liniarly
- 40bit state, 8bit output: 2^35 bytes
- 80bit state, 16bit output: 2^44 bytes
- 160bit state, 32bit output: >2^45 bytes
- 320bit state, 64bit output: >2^45 bytes
Probably scales liniarly
- 32bit state, 8bit output: 2^16 bytes
- 64bit state, 16bit output: 2^30 bytes
- 128bit state, 32bit output: >2^45 bytes
- 256bit state, 64bit output: >2^45 bytes
Probably scales liniarly
- 32bit state, 8bit output: 2^27 bytes
- 64bit state, 16bit output: >2^45 bytes (but probably close)
- 128bit state, 32bit output: >2^45 bytes
- 256bit state, 64bit output: >2^45 bytes
Probably scales worse than liniarly
- 32bit state, 8bit output: 2^28 bytes
- 64bit state, 16bit output: >2^45 bytes
- 128bit state, 32bit output: >2^45 bytes
- 256bit state, 64bit output: >2^45 bytes
Probably scales worse than liniarly
- 32bit state, 8bit output: 2^28 bytes
- 64bit state, 16bit output: >2^45 bytes
- 128bit state, 32bit output: >2^45 bytes
- 256bit state, 64bit output: >2^45 bytes
Probably scales liniarly
- 32bit state, 32bit output: 2^26 bytes
- 64bit state, 64bit output: 2^45 bytes
Probably scales liniarly
- 128bit state, 64bit output: 2^19 bytes
I am not into Cryptography, so I can only guess. PRs VERY much welcome.
Not Cryptographicly Safe, but probably annoying.
Not Cryptographicly Safe, probably predictable in 3-4 outputs.
Not Cryptographicly Safe, but probably much better than MWC.
Not Cryptographicly Safe, but probably annoying.
Not Cryptographicly Safe, but probably annoying.
Not Cryptographicly Safe, probably not trivial.
Not Cryptographicly Safe, predictable in 1-2 outputs, as it outputs the whole (changable) state.
Nanoseconds per Operations. PRs for other CPUs needed! At some point I should investigate "prof/spall" from the core library.
- Mac M2 Pro: 0.549 ns/op
- Mac M2 Pro: 0.565 ns/op
- Mac M2 Pro: 0.610 ns/op
- Mac M2 Pro: 0.992 ns/op
- Mac M2 Pro: 0.900 ns/op
- Mac M2 Pro: 0.381 ns/op
- Mac M2 Pro: 0.916 ns/op
WordBytes * 5
WordBytes * 4
WordBytes * 4
WordBytes * 4
WordBytes * 4
WordBytes
WordBytes * 2
Great on desktop CPUs. Its constant can be peppered.
Great on modern CPUs, not so much on CPUs with slow multiply. Can have an arbitrary long period. Can't easily be peppered.
Great on modern CPUs, not so much on CPUs with slow multiply. Can have an arbitrary long period. Can't easily be peppered.
Great on all CPUs. Its constant can be peppered.
Great on all CPUs. Its constant can be peppered.
Great on modern CPUs, not so much on CPUs with slow multiply. Its 2 constants can be peppered.
Use something else.
Feel free to ask or report anything. Also speed tests are currently needed.