Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document dependencies between PCG streams #1122

Merged
merged 1 commit into from
May 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion rand_pcg/src/pcg128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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`
Expand Down
8 changes: 7 additions & 1 deletion rand_pcg/src/pcg64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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`
Expand Down