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

Generates random striped unsigneds in the range $[a, b]$.

See here for more information.

The unsigneds are generated using a striped bit sequence with mean run length $m$ = mean_stripe_numerator / mean_stripe_denominator.

Because the unsigneds are constrained to be within a certain range, the actual mean run length will usually not be $m$. Nonetheless, setting a higher $m$ will result in a higher mean run length.

Expected complexity per iteration

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is b.significant_bits().

Panics

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

Examples

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

assert_eq!(
    prefix_to_string(
        striped_random_unsigned_inclusive_range::<u8>(EXAMPLE_SEED, 1, 6, 4, 1)
                .map(|x| x.to_binary_string()),
        10
    ),
    "[1, 1, 1, 110, 1, 110, 10, 11, 11, 100, ...]"
);