Skip to content

Commit 0ac3766

Browse files
committed
UniformInt: rename ints_to_reject/zone field
1 parent ca270f3 commit 0ac3766

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/distributions/uniform.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl<'a, Borrowed> SampleBorrow<Borrowed> for &'a Borrowed where Borrowed: Sampl
337337
pub struct UniformInt<X> {
338338
low: X,
339339
range: X,
340-
ints_to_reject: X,
340+
z: X, // either ints_to_reject or zone depending on implementation
341341
}
342342

343343
macro_rules! uniform_int_impl {
@@ -391,15 +391,15 @@ macro_rules! uniform_int_impl {
391391
low: low,
392392
// These are really $unsigned values, but store as $ty:
393393
range: range as $ty,
394-
ints_to_reject: ints_to_reject as $unsigned as $ty
394+
z: ints_to_reject as $unsigned as $ty
395395
}
396396
}
397397

398398
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
399399
let range = self.range as $unsigned as $u_large;
400400
if range > 0 {
401401
let unsigned_max = ::core::$u_large::MAX;
402-
let zone = unsigned_max - (self.ints_to_reject as $unsigned as $u_large);
402+
let zone = unsigned_max - (self.z as $unsigned as $u_large);
403403
loop {
404404
let v: $u_large = rng.gen();
405405
let (hi, lo) = v.wmul(range);
@@ -524,13 +524,13 @@ macro_rules! uniform_simd_int_impl {
524524
low: low,
525525
// These are really $unsigned values, but store as $ty:
526526
range: range.cast(),
527-
zone: zone.cast(),
527+
z: zone.cast(),
528528
}
529529
}
530530

531531
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Self::X {
532532
let range: $unsigned = self.range.cast();
533-
let zone: $unsigned = self.zone.cast();
533+
let zone: $unsigned = self.z.cast();
534534

535535
// This might seem very slow, generating a whole new
536536
// SIMD vector for every sample rejection. For most uses

0 commit comments

Comments
 (0)