pub fn random_ordered_unique_vecs_fixed_length<I: Iterator>(
    len: u64,
    xs: I
) -> RandomOrderedUniqueVecsFixedLength<I>Notable traits for RandomOrderedUniqueVecsFixedLength<I>impl<I: Iterator> Iterator for RandomOrderedUniqueVecsFixedLength<I> where
    I::Item: Ord
type Item = Vec<I::Item>;
where
    I::Item: Ord
Expand description

Randomly generates Vecs of a given length, where the Vecs have no repeated elements, and the elements are in ascending order.

The input iterator must generate at least len distinct elements; otherwise, this iterator will hang.

$$ P((x_i)_{i=0}^{n-1}) = n!\prod_{i=0}^{n-1}P(x_i). $$

The above formula assumes that the Vec is valid, \emph{i.e.} its elements are strictly increasing. The probability of an invalid Vec is zero.

If len is 0, the output consists of the empty list, repeated.

xs must be infinite.

Examples

extern crate itertools;

use itertools::Itertools;
use malachite_base::num::random::random_unsigned_inclusive_range;
use malachite_base::random::EXAMPLE_SEED;
use malachite_base::vecs::random::random_ordered_unique_vecs_fixed_length;

let xss = random_ordered_unique_vecs_fixed_length(
    2,
    random_unsigned_inclusive_range::<u32>(EXAMPLE_SEED, 1, 100),
)
.take(10)
.collect_vec();
assert_eq!(
    xss.iter().map(Vec::as_slice).collect_vec().as_slice(),
    &[
        &[24, 95],
        &[71, 99],
        &[53, 93],
        &[34, 85],
        &[2, 48],
        &[11, 55],
        &[18, 48],
        &[90, 93],
        &[67, 93],
        &[93, 95]
    ]
);