Skip to content

Commit 6107f93

Browse files
committed
Apply the same copy-editing to the existing generators as was discussed for Lcg128CmDxsm64.
1 parent ece8e48 commit 6107f93

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

rand_pcg/src/pcg128.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ impl Lcg128Xsl64 {
7777

7878
/// Construct an instance compatible with PCG seed and stream.
7979
///
80+
/// Note that the highest bit of the `stream` parameter is discarded
81+
/// to simplify upholding internal invariants.
82+
///
8083
/// Note that two generators with different stream parameters may be closely
8184
/// correlated.
8285
///
@@ -116,11 +119,11 @@ impl fmt::Debug for Lcg128Xsl64 {
116119
}
117120
}
118121

119-
/// We use a single 255-bit seed to initialise the state and select a stream.
120-
/// One `seed` bit (lowest bit of `seed[8]`) is ignored.
121122
impl SeedableRng for Lcg128Xsl64 {
122123
type Seed = [u8; 32];
123124

125+
/// We use a single 255-bit seed to initialise the state and select a stream.
126+
/// One `seed` bit (lowest bit of `seed[8]`) is ignored.
124127
fn from_seed(seed: Self::Seed) -> Self {
125128
let mut seed_u64 = [0u64; 4];
126129
le::read_u64_into(&seed, &mut seed_u64);

rand_pcg/src/pcg64.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ impl Lcg64Xsh32 {
7777

7878
/// Construct an instance compatible with PCG seed and stream.
7979
///
80+
/// Note that the highest bit of the `stream` parameter is discarded
81+
/// to simplify upholding internal invariants.
82+
///
8083
/// Note that two generators with different stream parameters may be closely
8184
/// correlated.
8285
///
@@ -117,11 +120,11 @@ impl fmt::Debug for Lcg64Xsh32 {
117120
}
118121
}
119122

120-
/// We use a single 127-bit seed to initialise the state and select a stream.
121-
/// One `seed` bit (lowest bit of `seed[8]`) is ignored.
122123
impl SeedableRng for Lcg64Xsh32 {
123124
type Seed = [u8; 16];
124125

126+
/// We use a single 127-bit seed to initialise the state and select a stream.
127+
/// One `seed` bit (lowest bit of `seed[8]`) is ignored.
125128
fn from_seed(seed: Self::Seed) -> Self {
126129
let mut seed_u64 = [0u64; 2];
127130
le::read_u64_into(&seed, &mut seed_u64);

rand_pcg/tests/lcg128xsl64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn test_lcg128xsl64_construction() {
3535
}
3636

3737
#[test]
38-
fn test_lcg128xsl64_true_values() {
38+
fn test_lcg128xsl64_reference() {
3939
// Numbers copied from official test suite (C version).
4040
let mut rng = Lcg128Xsl64::new(42, 54);
4141

rand_pcg/tests/lcg64xsh32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn test_lcg64xsh32_construction() {
3333
}
3434

3535
#[test]
36-
fn test_lcg64xsh32_true_values() {
36+
fn test_lcg64xsh32_reference() {
3737
// Numbers copied from official test suite.
3838
let mut rng = Lcg64Xsh32::new(42, 54);
3939

rand_pcg/tests/mcg128xsl64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn test_mcg128xsl64_construction() {
3333
}
3434

3535
#[test]
36-
fn test_mcg128xsl64_true_values() {
36+
fn test_mcg128xsl64_reference() {
3737
// Numbers copied from official test suite (C version).
3838
let mut rng = Mcg128Xsl64::new(42);
3939

0 commit comments

Comments
 (0)