10
10
11
11
use rand_core:: { Error , RngCore , SeedableRng } ;
12
12
13
- #[ cfg( all ( not ( target_os = "emscripten" ) , target_pointer_width = "64" ) ) ]
14
- type Rng = rand_pcg :: Pcg64Mcg ;
15
- #[ cfg( not( all ( not ( target_os = "emscripten" ) , target_pointer_width = "64" ) ) ) ]
16
- type Rng = rand_pcg :: Pcg32 ;
13
+ #[ cfg( target_pointer_width = "64" ) ]
14
+ type Rng = super :: xoshiro256plusplus :: Xoshiro256PlusPlus ;
15
+ #[ cfg( not( target_pointer_width = "64" ) ) ]
16
+ type Rng = super :: xoshiro128plusplus :: Xoshiro128PlusPlus ;
17
17
18
18
/// A small-state, fast non-crypto PRNG
19
19
///
@@ -25,15 +25,14 @@ type Rng = rand_pcg::Pcg32;
25
25
/// The algorithm is deterministic but should not be considered reproducible
26
26
/// due to dependence on platform and possible replacement in future
27
27
/// library versions. For a reproducible generator, use a named PRNG from an
28
- /// external crate, e.g. [rand_pcg ] or [rand_chacha].
28
+ /// external crate, e.g. [rand_xoshiro ] or [rand_chacha].
29
29
/// Refer also to [The Book](https://rust-random.github.io/book/guide-rngs.html).
30
30
///
31
- /// The PRNG algorithm in `SmallRng` is chosen to be
32
- /// efficient on the current platform, without consideration for cryptography
33
- /// or security. The size of its state is much smaller than [`StdRng`].
34
- /// The current algorithm is [`Pcg64Mcg`](rand_pcg::Pcg64Mcg) on 64-bit
35
- /// platforms and [`Pcg32`](rand_pcg::Pcg32) on 32-bit platforms. Both are
36
- /// implemented by the [rand_pcg] crate.
31
+ /// The PRNG algorithm in `SmallRng` is chosen to be efficient on the current
32
+ /// platform, without consideration for cryptography or security. The size of
33
+ /// its state is much smaller than [`StdRng`]. The current algorithm is
34
+ /// `Xoshiro256PlusPlus` on 64-bit platforms and `Xoshiro128PlusPlus` on 32-bit
35
+ /// platforms. Both are implemented by the [rand_xoshiro] crate.
37
36
///
38
37
/// # Examples
39
38
///
@@ -69,7 +68,7 @@ type Rng = rand_pcg::Pcg32;
69
68
/// [`StdRng`]: crate::rngs::StdRng
70
69
/// [`thread_rng`]: crate::thread_rng
71
70
/// [rand_chacha]: https://crates.io/crates/rand_chacha
72
- /// [rand_pcg ]: https://crates.io/crates/rand_pcg
71
+ /// [rand_xoshiro ]: https://crates.io/crates/rand_pcg
73
72
#[ cfg_attr( doc_cfg, doc( cfg( feature = "small_rng" ) ) ) ]
74
73
#[ derive( Clone , Debug , PartialEq , Eq ) ]
75
74
pub struct SmallRng ( Rng ) ;
0 commit comments