@@ -39,19 +39,19 @@ You may wish to refer to the [pcg-random] and [xoshiro] websites.
3939
4040| name | full name | performance | memory | quality | period | features |
4141| ------| -----------| -------------| --------| ---------| --------| ----------|
42- | [ ` SmallRng ` ] | (unspecified) | 7 GB/s | 16 bytes | ★★★☆☆ | ≥ ` u32 ` * 2<sup >64</sup > | not portable |
43- | [ ` Pcg32 ` ] | PCG XSH RR 64/32 (LCG) | 3 GB/s | 16 bytes | ★★★☆☆ | ` u32 ` * 2<sup >64</sup > | — |
44- | [ ` Pcg64 ` ] | PCG XSL 128/64 (LCG) | 4 GB/s | 32 bytes | ★★★☆☆ | ` u64 ` * 2<sup >128</sup > | — |
45- | [ ` Pcg64Mcg ` ] | PCG XSL 128/64 (MCG) | 7 GB/s | 16 bytes | ★★★☆☆ | ` u64 ` * 2<sup >126</sup > | — |
46- | [ ` XorShiftRng ` ] | Xorshift 32/128 | 5 GB/s | 16 bytes | ★☆☆☆☆ | ` u32 ` * 2<sup >128</sup > - 1 | — |
47- | [ ` Xoshiro256PlusPlus ` ] | Xoshiro256++ | 7 GB/s | 32 bytes | ★★★☆☆ | ` u64 ` * 2<sup >256</sup > - 1 | jump-ahead |
48- | [ ` Xoshiro256Plus ` ] | Xoshiro256+ | 8 GB/s | 32 bytes | ★★☆☆☆ | ` u64 ` * 2<sup >256</sup > - 1 | jump-ahead |
49- | [ ` SplitMix64 ` ] | splitmix64 | 8 GB/s | 8 bytes | ★☆☆☆☆ | ` u64 ` * 2<sup >64</sup > | — |
50- | [ ` StepRng ` ] | counter | 51 GB/s | 16 bytes | ☆☆☆☆☆ | ` u64 ` * 2<sup >64</sup > | — |
51-
52- Here, performance is measured roughly for ` u64 ` outputs on a 3.4GHz Haswell CPU
53- (note that this will vary significantly by application; in general cryptographic
54- RNGs do better with byte sequence output). Quality ratings are
42+ | [ ` SmallRng ` ] | (unspecified) | 11 GB/s | 16 bytes | ★★★☆☆ | ≥ ` u32 ` * 2<sup >64</sup > | not portable |
43+ | [ ` Pcg32 ` ] | PCG XSH RR 64/32 (LCG) | 5 GB/s | 16 bytes | ★★★☆☆ | ` u32 ` * 2<sup >64</sup > | — |
44+ | [ ` Pcg64 ` ] | PCG XSL 128/64 (LCG) | 7 GB/s | 32 bytes | ★★★☆☆ | ` u64 ` * 2<sup >128</sup > | — |
45+ | [ ` Pcg64Mcg ` ] | PCG XSL 128/64 (MCG) | 8 GB/s | 16 bytes | ★★★☆☆ | ` u64 ` * 2<sup >126</sup > | — |
46+ | [ ` XorShiftRng ` ] | Xorshift 32/128 | 7 GB/s | 16 bytes | ★☆☆☆☆ | ` u32 ` * 2<sup >128</sup > - 1 | — |
47+ | [ ` Xoshiro256PlusPlus ` ] | Xoshiro256++ | 11 GB/s | 32 bytes | ★★★☆☆ | ` u64 ` * 2<sup >256</sup > - 1 | jump-ahead |
48+ | [ ` Xoshiro256Plus ` ] | Xoshiro256+ | 13 GB/s | 32 bytes | ★★☆☆☆ | ` u64 ` * 2<sup >256</sup > - 1 | jump-ahead |
49+ | [ ` SplitMix64 ` ] | splitmix64 | 13 GB/s | 8 bytes | ★☆☆☆☆ | ` u64 ` * 2<sup >64</sup > | — |
50+ | ` StepRng ` | counter | 35 GB/s | 16 bytes | ☆☆☆☆☆ | ` u64 ` * 2<sup >64</sup > | — |
51+
52+ Here, performance is measured roughly for ` u64 ` outputs on an
53+ AMD Ryzen 9 9950X3D (note that this will vary significantly by application; in
54+ general cryptographic RNGs do better with byte sequence output). Quality ratings are
5555based on theory and observable defects, roughly as follows:
5656
5757- ★☆☆☆☆ = suitable for simple applications but with significant flaws
@@ -79,12 +79,12 @@ table since CSPRNGs may not have observable defects.
7979
8080| name | full name | performance | initialization | memory | security (predictability) | forward secrecy |
8181| ------| -----------| --------------| --------------| ----------| ----------------| -------------------------|
82- | [ ` StdRng ` ] | (unspecified) | 1.5 GB/s | fast | 136 bytes | widely trusted | no |
83- | [ ` ChaCha20Rng ` ] | ChaCha20 | 1.8 GB/s | fast | 136 bytes | [ rigorously analysed] ( https://tools.ietf.org/html/rfc7539#section-1 ) | no |
84- | [ ` ChaCha8Rng ` ] | ChaCha8 | 2.2 GB/s | fast | 136 bytes | small security margin | no |
85- | [ ` Hc128Rng ` ] | HC-128 | 2.1 GB/s | slow | 4176 bytes | [ recommended by eSTREAM] ( http://www.ecrypt.eu.org/stream/ ) | no |
86- | [ ` IsaacRng ` ] | ISAAC | 1 .1 GB/s | slow | 2072 bytes | [ unknown] ( https://burtleburtle.net/bob/rand/isaacafa.html ) | unknown |
87- | [ ` Isaac64Rng ` ] | ISAAC-64 | 2.2 GB/s | slow | 4136 bytes| unknown | unknown |
82+ | [ ` StdRng ` ] | (unspecified) | 4.1 GB/s | fast | 136 bytes | widely trusted | no |
83+ | [ ` ChaCha20Rng ` ] | ChaCha20 | 2.6 GB/s | fast | 136 bytes | [ rigorously analysed] ( https://tools.ietf.org/html/rfc7539#section-1 ) | no |
84+ | [ ` ChaCha8Rng ` ] | ChaCha8 | 5.8 GB/s | fast | 136 bytes | small security margin | no |
85+ | [ ` Hc128Rng ` ] | HC-128 | 4.6 GB/s | slow | 4176 bytes | [ recommended by eSTREAM] ( http://www.ecrypt.eu.org/stream/ ) | no |
86+ | [ ` IsaacRng ` ] | ISAAC | 2 .1 GB/s | slow | 2072 bytes | [ unknown] ( https://burtleburtle.net/bob/rand/isaacafa.html ) | unknown |
87+ | [ ` Isaac64Rng ` ] | ISAAC-64 | 3.7 GB/s | slow | 4136 bytes| unknown | unknown |
8888
8989It should be noted that the ISAAC generators are only included for
9090historical reasons: they have been with the Rust language since the very
@@ -131,13 +131,13 @@ Mersenne Twister MT19937 algorithm requires 2.5 kB of state.
131131CSPRNGs typically require more memory; since the seed size is recommended
132132to be at least 192 bits and some more may be required for the algorithm,
133133256 bits would be approximately the minimum secure size. In practice,
134- CSPRNGs tend to use quite a bit more, [ ` ChaChaRng ` ] is relatively small with
134+ CSPRNGs tend to use quite a bit more, [ ` ChaCha20Rng ` ] is relatively small with
135135136 bytes of state.
136136
137137### Initialization time
138138
139139The time required to initialize new generators varies significantly. Many
140- simple PRNGs and even some cryptographic ones (including [ ` ChaChaRng ` ] )
140+ simple PRNGs and even some cryptographic ones (including [ ` ChaCha20Rng ` ] )
141141only need to copy the seed value and some constants into their state, and
142142thus can be constructed very quickly. In contrast, CSPRNGs with large state
143143require an expensive key-expansion.
@@ -311,7 +311,6 @@ by P. Hellekalek.
311311[ `rngs` module ] : https://docs.rs/rand/latest/rand/rngs/
312312[ `SmallRng` ] : https://docs.rs/rand/latest/rand/rngs/struct.SmallRng.html
313313[ `StdRng` ] : https://docs.rs/rand/latest/rand/rngs/struct.StdRng.html
314- [ `StepRng` ] : https://docs.rs/rand/latest/rand/rngs/mock/struct.StepRng.html
315314[ `rand::rng` ] : https://docs.rs/rand/latest/rand/fn.rng.html
316315[ basic PRNGs ] : #basic-pseudo-random-number-generators-prngs
317316[ CSPRNGs ] : #cryptographically-secure-pseudo-random-number-generators-csprngs
@@ -322,9 +321,8 @@ by P. Hellekalek.
322321[ `Xoshiro256PlusPlus` ] : https://docs.rs/rand_xoshiro/latest/rand_xoshiro/struct.Xoshiro256PlusPlus.html
323322[ `Xoshiro256Plus` ] : https://docs.rs/rand_xoshiro/latest/rand_xoshiro/struct.Xoshiro256Plus.html
324323[ `SplitMix64` ] : https://docs.rs/rand_xoshiro/latest/rand_xoshiro/struct.SplitMix64.html
325- [ `ChaChaRng` ] : https://docs.rs/rand_chacha/latest/rand_chacha/type.ChaChaRng.html
326- [ `ChaCha20Rng` ] : https://docs.rs/rand_chacha/latest/rand_chacha/struct.ChaCha20Rng.html
327- [ `ChaCha8Rng` ] : https://docs.rs/rand_chacha/latest/rand_chacha/struct.ChaCha8Rng.html
324+ [ `ChaCha20Rng` ] : https://docs.rs/chacha20/latest/chacha20/struct.ChaCha20Rng.html
325+ [ `ChaCha8Rng` ] : https://docs.rs/chacha20/latest/chacha20/struct.ChaCha8Rng.html
328326[ `Hc128Rng` ] : https://docs.rs/rand_hc/latest/rand_hc/struct.Hc128Rng.html
329327[ `IsaacRng` ] : https://docs.rs/rand_isaac/latest/rand_isaac/isaac/struct.IsaacRng.html
330328[ `Isaac64Rng` ] : https://docs.rs/rand_isaac/latest/rand_isaac/isaac64/struct.Isaac64Rng.html
0 commit comments