pub fn striped_random_natural_range_to_infinity(
    seed: Seed,
    a: Natural,
    mean_stripe_numerator: u64,
    mean_stripe_denominator: u64,
    mean_bits_numerator: u64,
    mean_bits_denominator: u64
) -> StripedRandomNaturalRangeToInfinity 
Expand description

Generates striped random Naturals greater than or equal to a lower bound $a$.

The mean bit length $m$ of the Naturals 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).

The Naturals are generated using a striped bit sequence with mean run length $m$ = 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.

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 their ratio is less than or equal to $a$, 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::natural::random::striped_random_natural_range_to_infinity;
use malachite_nz::natural::Natural;

assert_eq!(
    prefix_to_string(
        striped_random_natural_range_to_infinity(
            EXAMPLE_SEED,
            Natural::from(1000u32),
            20,
            1,
            14,
            1
        ),
        10
    ),
    "[8192, 14336, 16376, 1024, 1024, 1023, 2047, 245760, 8195, 131070, ...]"
)