Skip to content

Commit f0e01ee

Browse files
authored
Merge pull request #1122 from vks/pcg-stream-corr
Document dependencies between PCG streams
2 parents 30d2d98 + 9121d39 commit f0e01ee

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

rand_pcg/src/pcg128.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ use rand_core::{le, Error, RngCore, SeedableRng};
2929
/// Despite the name, this implementation uses 32 bytes (256 bit) space
3030
/// comprising 128 bits of state and 128 bits stream selector. These are both
3131
/// set by `SeedableRng`, using a 256-bit seed.
32+
///
33+
/// Note that two generators with different stream parameters may be closely
34+
/// correlated.
3235
#[derive(Clone, PartialEq, Eq)]
3336
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
3437
pub struct Lcg128Xsl64 {
@@ -74,7 +77,10 @@ impl Lcg128Xsl64 {
7477

7578
/// Construct an instance compatible with PCG seed and stream.
7679
///
77-
/// Note that PCG specifies default values for both parameters:
80+
/// Note that two generators with different stream parameters may be closely
81+
/// correlated.
82+
///
83+
/// PCG specifies the following default values for both parameters:
7884
///
7985
/// - `state = 0xcafef00dd15ea5e5`
8086
/// - `stream = 0xa02bdbf7bb3c0a7ac28fa16a64abf96`

rand_pcg/src/pcg64.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const MULTIPLIER: u64 = 6364136223846793005;
2929
/// Despite the name, this implementation uses 16 bytes (128 bit) space
3030
/// comprising 64 bits of state and 64 bits stream selector. These are both set
3131
/// by `SeedableRng`, using a 128-bit seed.
32+
///
33+
/// Note that two generators with different stream parameter may be closely
34+
/// correlated.
3235
#[derive(Clone, PartialEq, Eq)]
3336
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
3437
pub struct Lcg64Xsh32 {
@@ -74,7 +77,10 @@ impl Lcg64Xsh32 {
7477

7578
/// Construct an instance compatible with PCG seed and stream.
7679
///
77-
/// Note that PCG specifies default values for both parameters:
80+
/// Note that two generators with different stream parameters may be closely
81+
/// correlated.
82+
///
83+
/// PCG specifies the following default values for both parameters:
7884
///
7985
/// - `state = 0xcafef00dd15ea5e5`
8086
/// - `stream = 0xa02bdbf7bb3c0a7`

0 commit comments

Comments
 (0)