Function malachite_base::tuples::random::random_ordered_unique_pairs
source · [−]pub const fn random_ordered_unique_pairs<I: Iterator>(
xs: I
) -> RandomOrderedUniquePairs<I>ⓘNotable traits for RandomOrderedUniquePairs<I>impl<I: Iterator> Iterator for RandomOrderedUniquePairs<I> where
I::Item: Ord, type Item = (I::Item, I::Item);
where
I::Item: Ord,
Expand description
Generates random pairs using elements from a single iterator, where the first element of each pair is less than the second.
The input iterator must generate at least len
distinct elements; otherwise, this iterator
will hang.
$$ P((x_0, x_1)) = 2P(x_0)P(x_1). $$
The above formula assumes that the pair is valid, \emph{i.e.} its first element is less than its second. The probability of an invalid pair is zero.
xs
must be infinite.