Skip to content

Commit

Permalink
Add hint about choose_stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincox committed Oct 10, 2020
1 parent 7b35598 commit b34ed44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/seq/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`].
///
/// For slices, prefer [`SliceRandom::choose`] which guarantees `O(1)`
/// performance.
Expand Down

0 comments on commit b34ed44

Please sign in to comment.