pub fn striped_random_natural_range(
    seed: Seed,
    a: Natural,
    b: Natural,
    mean_stripe_numerator: u64,
    mean_stripe_denominator: u64
) -> StripedRandomNaturalInclusiveRange 
Expand description

Generates random striped Naturals in the range $[a, b)$.

The Natural are generated using a striped bit sequence with mean run length $m$, which is mean_stripe_numerator / mean_stripe_denominator.

Because the Natural 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.

See StripedBitSource for information about generating striped random numbers.

§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::basic::traits::One;
use malachite_base::random::EXAMPLE_SEED;
use malachite_base::strings::ToBinaryString;
use malachite_nz::natural::Natural;
use malachite_nz::natural::random::striped_random_natural_range;

assert_eq!(
    prefix_to_string(
        striped_random_natural_range(EXAMPLE_SEED, Natural::ONE, Natural::from(7u32), 4, 1)
                .map(|x| x.to_binary_string()),
        10
    ),
    "[1, 1, 1, 110, 1, 110, 10, 11, 11, 100, ...]"
);