Function malachite_base::tuples::random::random_ordered_unique_pairs
source · pub const fn random_ordered_unique_pairs<I: Iterator>(
xs: I
) -> RandomOrderedUniquePairs<I> ⓘ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 two 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.