pub fn random_hash_sets_fixed_length<I: Iterator>(
    len: u64,
    xs: I
) -> RandomHashSetsFixedLength<I>Notable traits for RandomHashSetsFixedLength<I>impl<I: Iterator> Iterator for RandomHashSetsFixedLength<I> where
    I::Item: Eq + Hash
type Item = HashSet<I::Item>;
where
    I::Item: Eq + Hash
Expand description

Randomly generates HashSets of a given length.

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). $$

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

xs must be infinite.

Examples

extern crate itertools;
#[macro_use]
extern crate maplit;

use itertools::Itertools;
use malachite_base::num::random::random_unsigned_inclusive_range;
use malachite_base::random::EXAMPLE_SEED;
use malachite_base::sets::random::random_hash_sets_fixed_length;

fn main() {
    let xss = random_hash_sets_fixed_length(
        2,
        random_unsigned_inclusive_range::<u32>(EXAMPLE_SEED, 1, 100),
    )
    .take(10)
    .collect_vec();
    assert_eq!(
        xss,
        &[
            hashset!{24, 95},
            hashset!{71, 99},
            hashset!{53, 93},
            hashset!{34, 85},
            hashset!{2, 48},
            hashset!{11, 55},
            hashset!{18, 48},
            hashset!{90, 93},
            hashset!{67, 93},
            hashset!{93, 95}
        ]
    );
}