pub const fn random_fixed_length_strings_using_chars<I: Iterator<Item = char>>(
len: u64,
cs: I,
) -> StringsFromCharVecs<RandomFixedLengthVecsFromSingle<I>> ⓘ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.
§Expected complexity per iteration
$T(i) = O(\ell + T^\prime(i))$
$M(i) = O(\ell + M^\prime(i))$
where $T$ is time, $M$ is additional memory, $i$ is the iteration number, $T^\prime$ and
$M^\prime$ are the time and memory functions of cs, and $\ell$ is len.
§Examples
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"]
);