From 6e4abb945b06ba4b449122f466547fe1aa0257cb Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Mon, 3 Jun 2019 12:31:20 +0100 Subject: [PATCH] UniformInt: rename ints_to_reject/zone field --- src/distributions/uniform.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/distributions/uniform.rs b/src/distributions/uniform.rs index 8f51f5aa402..c1a1b2594e0 100644 --- a/src/distributions/uniform.rs +++ b/src/distributions/uniform.rs @@ -337,7 +337,7 @@ impl<'a, Borrowed> SampleBorrow for &'a Borrowed where Borrowed: Sampl pub struct UniformInt { low: X, range: X, - ints_to_reject: X, + z: X, // either ints_to_reject or zone depending on implementation } macro_rules! uniform_int_impl { @@ -391,7 +391,7 @@ macro_rules! uniform_int_impl { low: low, // These are really $unsigned values, but store as $ty: range: range as $ty, - ints_to_reject: ints_to_reject as $unsigned as $ty + z: ints_to_reject as $unsigned as $ty } } @@ -399,7 +399,7 @@ macro_rules! uniform_int_impl { let range = self.range as $unsigned as $u_large; if range > 0 { let unsigned_max = ::core::$u_large::MAX; - let zone = unsigned_max - (self.ints_to_reject as $unsigned as $u_large); + let zone = unsigned_max - (self.z as $unsigned as $u_large); loop { let v: $u_large = rng.gen(); let (hi, lo) = v.wmul(range); @@ -524,13 +524,13 @@ macro_rules! uniform_simd_int_impl { low: low, // These are really $unsigned values, but store as $ty: range: range.cast(), - zone: zone.cast(), + z: zone.cast(), } } fn sample(&self, rng: &mut R) -> Self::X { let range: $unsigned = self.range.cast(); - let zone: $unsigned = self.zone.cast(); + let zone: $unsigned = self.z.cast(); // This might seem very slow, generating a whole new // SIMD vector for every sample rejection. For most uses