pub fn striped_random_integer_range_to_negative_infinity(
    seed: Seed,
    a: Integer,
    mean_stripe_numerator: u64,
    mean_stripe_denominator: u64,
    mean_bits_numerator: u64,
    mean_bits_denominator: u64
) -> StripedRandomIntegerRangeToInfinity 
Expand description

Generates striped random Integers less than or equal to an upper bound $a$.

The mean bit length $m$ of the Integers is specified; it must be greater than the bit length of $a$. $m$ is equal to mean_bits_numerator / mean_bits_denominator.

The actual bit length is chosen from a geometric distribution with lower bound $a$ and mean $m$. The resulting distribution has no mean or higher-order statistics (unless $a < m < a + 1$, which is not typical).

Because the Integers are constrained to be within a certain range, the actual mean run length will usually not be $\mu$. Nonetheless, setting a higher $\mu$ 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, m) = O(n + m)$

$M(n, m) = O(n / m)$

where $T$ is time, $M$ is additional memory, $n$ is mean_precision_numerator, and $m$ is mean_precision_denominator.

§Panics

Panics if mean_stripe_denominator is zero, if mean_stripe_numerator < mean_stripe_denominator, if mean_bits_numerator or mean_bits_denominator are zero, if $b < 0$ and their ratio is less than or equal to the bit length of $b$, or if they are too large and manipulating them leads to arithmetic overflow.

§Examples

use malachite_base::iterators::prefix_to_string;
use malachite_base::random::EXAMPLE_SEED;
use malachite_nz::integer::random::striped_random_integer_range_to_negative_infinity;
use malachite_nz::integer::Integer;

assert_eq!(
    prefix_to_string(
        striped_random_integer_range_to_negative_infinity(
            EXAMPLE_SEED,
            Integer::from(1000),
            20,
            1,
            10,
            1
        ),
        10
    ),
    "[4, 2, -1024, -144115188075919360, -516096, 992, -15, -16776704, 511, 64, ...]"
)