pub const fn random_fixed_length_strings_using_chars<I: Iterator<Item = char>>(
    len: u64,
    cs: I
) -> StringsFromCharVecs<RandomFixedLengthVecsFromSingle<I>>Notable traits for StringsFromCharVecs<I>impl<I: Iterator<Item = Vec<char>>> Iterator for StringsFromCharVecs<I> type Item = String;
Expand description

Randomly generates Strings of a given length using chars from a single iterator.

The probability of a particular length-$n$ String being generated is the product of the probabilities of each of its chars.

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

cs must be infinite.

Examples

extern crate itertools;

use itertools::Itertools;
use malachite_base::chars::random::random_char_inclusive_range;
use malachite_base::random::EXAMPLE_SEED;
use malachite_base::strings::random::random_fixed_length_strings_using_chars;

let ss = random_fixed_length_strings_using_chars(
    2,
    random_char_inclusive_range(EXAMPLE_SEED, 'a', 'c'),
)
.take(10)
.collect_vec();
assert_eq!(
    ss.iter().map(|cs| cs.as_str()).collect_vec().as_slice(),
    &["ba", "bc", "bb", "ab", "ac", "ba", "bc", "ca", "ba", "cc"]
);