From 7ee6cd1f84b215fc1fa97097b64737897320f625 Mon Sep 17 00:00:00 2001 From: Kevin Cox Date: Sat, 10 Oct 2020 18:52:51 -0400 Subject: [PATCH] Add hint about choose_stable. --- src/seq/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/seq/mod.rs b/src/seq/mod.rs index 421a59b6f38..f8d21c9a444 100644 --- a/src/seq/mod.rs +++ b/src/seq/mod.rs @@ -292,10 +292,11 @@ pub trait IteratorRandom: Iterator + Sized { /// available, complexity is `O(n)` where `n` is the iterator length. /// Partial hints (where `lower > 0`) also improve performance. /// - /// Note that the output values and the the number of RNG samples used + /// Note that the output values and the number of RNG samples used /// depends on size hints. In particular, `Iterator` combinators that don't /// change the values yielded but change the size hints may result in - /// `choose` returning different elements. + /// `choose` returning different elements. If you want consistent results + /// and RNG usage consider using [`choose_stable`]. fn choose(mut self, rng: &mut R) -> Option where R: Rng + ?Sized { let (mut lower, mut upper) = self.size_hint();