From 9121d397321d6d0d4fa76e8b335d94a8d83f7a6f Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Fri, 7 May 2021 18:33:06 -0300 Subject: [PATCH] Document dependencies between PCG streams Fixes #907. --- rand_pcg/src/pcg128.rs | 8 +++++++- rand_pcg/src/pcg64.rs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/rand_pcg/src/pcg128.rs b/rand_pcg/src/pcg128.rs index 2c5b249595..f81b7fa839 100644 --- a/rand_pcg/src/pcg128.rs +++ b/rand_pcg/src/pcg128.rs @@ -29,6 +29,9 @@ use rand_core::{le, Error, RngCore, SeedableRng}; /// Despite the name, this implementation uses 32 bytes (256 bit) space /// comprising 128 bits of state and 128 bits stream selector. These are both /// set by `SeedableRng`, using a 256-bit seed. +/// +/// Note that two generators with different stream parameters may be closely +/// correlated. #[derive(Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))] pub struct Lcg128Xsl64 { @@ -74,7 +77,10 @@ impl Lcg128Xsl64 { /// Construct an instance compatible with PCG seed and stream. /// - /// Note that PCG specifies default values for both parameters: + /// Note that two generators with different stream parameters may be closely + /// correlated. + /// + /// PCG specifies the following default values for both parameters: /// /// - `state = 0xcafef00dd15ea5e5` /// - `stream = 0xa02bdbf7bb3c0a7ac28fa16a64abf96` diff --git a/rand_pcg/src/pcg64.rs b/rand_pcg/src/pcg64.rs index dc157fc339..602d7bb37f 100644 --- a/rand_pcg/src/pcg64.rs +++ b/rand_pcg/src/pcg64.rs @@ -29,6 +29,9 @@ const MULTIPLIER: u64 = 6364136223846793005; /// Despite the name, this implementation uses 16 bytes (128 bit) space /// comprising 64 bits of state and 64 bits stream selector. These are both set /// by `SeedableRng`, using a 128-bit seed. +/// +/// Note that two generators with different stream parameter may be closely +/// correlated. #[derive(Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))] pub struct Lcg64Xsh32 { @@ -74,7 +77,10 @@ impl Lcg64Xsh32 { /// Construct an instance compatible with PCG seed and stream. /// - /// Note that PCG specifies default values for both parameters: + /// Note that two generators with different stream parameters may be closely + /// correlated. + /// + /// PCG specifies the following default values for both parameters: /// /// - `state = 0xcafef00dd15ea5e5` /// - `stream = 0xa02bdbf7bb3c0a7`