From bfd1826c36c441236f218af478edd794bca7f23a Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Fri, 31 Jan 2025 09:13:27 +0000 Subject: [PATCH] SeedableRng docs: add note on (lack of) reproducibility (#1572) --- rand_core/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rand_core/src/lib.rs b/rand_core/src/lib.rs index 9faff9c752..a873ab60ad 100644 --- a/rand_core/src/lib.rs +++ b/rand_core/src/lib.rs @@ -306,6 +306,13 @@ impl CryptoRng for UnwrapErr {} /// This trait encapsulates the low-level functionality common to all /// pseudo-random number generators (PRNGs, or algorithmic generators). /// +/// A generator implementing `SeedableRng` will usually be deterministic, but +/// beware that portability and reproducibility of results **is not implied**. +/// Refer to documentation of the generator, noting that generators named after +/// a specific algorithm are usually tested for reproducibility against a +/// reference vector, while `SmallRng` and `StdRng` specifically opt out of +/// reproducibility guarantees. +/// /// [`rand`]: https://docs.rs/rand pub trait SeedableRng: Sized { /// Seed type, which is restricted to types mutably-dereferenceable as `u8`