pub fn striped_random_unsigned_vecs_length_range<T: PrimitiveUnsigned>(
    seed: Seed,
    a: u64,
    b: u64,
    mean_stripe_numerator: u64,
    mean_stripe_denominator: u64
) -> StripedRandomUnsignedVecs<T, RandomUnsignedRange<u64>>Notable traits for StripedRandomUnsignedVecs<T, I>impl<T: PrimitiveUnsigned, I: Iterator<Item = u64>> Iterator for StripedRandomUnsignedVecs<T, I> type Item = Vec<T>;
Expand description

Generates random striped Vecs of unsigneds, with lengths in $[a, b)$.

See here for more information.

The lengths of the Vecs are sampled from a uniform distribution on $[a, b)$. $a$ must be less than $b$.

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

$$ P((x_0, x_1, \ldots, x_{n-1})) = \begin{cases} \frac{1}{b-a}\prod_{i=0}^{n-1}P(x_i) & \text{if} \quad a \leq n < b, \\ 0 & \text{otherwise}. \end{cases} $$

Expected complexity per iteration

$T(n) = O(b)$

$M(n) = O(b)$

where $T$ is time and $M$ is additional memory.

Panics

Panics if mean_stripe_denominator is zero, if mean_stripe_numerator <= mean_stripe_denominator, or if $a \geq b$.

Examples

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

assert_eq!(
    prefix_to_string(
        striped_random_unsigned_vecs_length_range::<u8>(EXAMPLE_SEED, 2, 4, 10, 1)
                .map(
                    |xs| prefix_to_string(
                        xs.into_iter().map(|x: u8| x.to_binary_string()),
                        100
                    )
                ),
        10,
    ),
    "[[0, 0, 111000], [0, 11111100], [11111000, 1, 11110000], [0, 0, 0], \
    [11110000, 11111111], [11111111, 11, 11111111], [1000000, 0, 11110000], \
    [11111111, 11111111], [1111000, 11000000, 11111111], [11111111, 11111111, 1100], ...]"
);