pub fn striped_random_bool_vecs(
    seed: Seed,
    mean_stripe_numerator: u64,
    mean_stripe_denominator: u64,
    mean_length_numerator: u64,
    mean_length_denominator: u64
) -> StripedRandomBoolVecs<GeometricRandomNaturalValues<u64>>Notable traits for StripedRandomBoolVecs<I>impl<I: Iterator<Item = u64>> Iterator for StripedRandomBoolVecs<I> type Item = Vec<bool>;
Expand description

Generates random striped Vec<bool>s.

See here for more information.

The lengths of the Vecs are sampled from a geometric distribution with a specified mean $m$, equal to mean_length_numerator / mean_length_denominator. $m$ must be greater than 0.

The mean run length (before the bit sequences are truncated) is $m$ = mean_stripe_numerator / mean_stripe_denominator.

Expected complexity per iteration

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is mean_length_numerator / mean_length_denominator.

Panics

Panics if mean_stripe_denominator is zero, if mean_stripe_numerator <= mean_stripe_denominator, if mean_length_numerator or mean_length_denominator are zero, or, if after being reduced to lowest terms, their sum is greater than or equal to $2^{64}$.

Examples

use malachite_base::iterators::prefix_to_string;
use malachite_base::num::random::striped::striped_random_bool_vecs;
use malachite_base::random::EXAMPLE_SEED;
use malachite_base::strings::ToBinaryString;

assert_eq!(
    prefix_to_string(
        striped_random_bool_vecs(EXAMPLE_SEED, 10, 1, 2, 1)
                .map(
                    |bs| bs.into_iter().map(|b| if b { '1' } else { '0' }).collect::<String>()
                ),
        20
    ),
    "[000000, 0, 00000000, 0, 00000001110000, , 11111, 0000, 1, , 011111, 11, , , 1, 000, , \
    0, , 0, ...]"
);