Skip to content

Commit 7ee6cd1

Browse files
committed
Add hint about choose_stable.
1 parent 0811186 commit 7ee6cd1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/seq/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,11 @@ pub trait IteratorRandom: Iterator + Sized {
292292
/// available, complexity is `O(n)` where `n` is the iterator length.
293293
/// Partial hints (where `lower > 0`) also improve performance.
294294
///
295-
/// Note that the output values and the the number of RNG samples used
295+
/// Note that the output values and the number of RNG samples used
296296
/// depends on size hints. In particular, `Iterator` combinators that don't
297297
/// change the values yielded but change the size hints may result in
298-
/// `choose` returning different elements.
298+
/// `choose` returning different elements. If you want consistent results
299+
/// and RNG usage consider using [`choose_stable`].
299300
fn choose<R>(mut self, rng: &mut R) -> Option<Self::Item>
300301
where R: Rng + ?Sized {
301302
let (mut lower, mut upper) = self.size_hint();

0 commit comments

Comments
 (0)