pub fn striped_random_integer_inclusive_range(
    seed: Seed,
    a: Integer,
    b: Integer,
    mean_stripe_numerator: u64,
    mean_stripe_denominator: u64
) -> StripedRandomIntegerInclusiveRange 
Expand description

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

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

The output length is infinite.

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 max(a.significant_bits(), 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::random::EXAMPLE_SEED;
use malachite_base::strings::ToBinaryString;
use malachite_nz::integer::Integer;
use malachite_nz::integer::random::striped_random_integer_inclusive_range;

assert_eq!(
    prefix_to_string(
        striped_random_integer_inclusive_range(
            EXAMPLE_SEED,
            Integer::from(-4),
            Integer::from(6),
            4,
            1
        ).map(|x| x.to_binary_string()),
        10
    ),
    "[-100, -100, 110, 11, -100, 0, 110, 11, 0, 110, ...]"
);