pub fn random_integer_range_to_negative_infinity(
    seed: Seed,
    a: Integer,
    mean_bits_numerator: u64,
    mean_bits_denominator: u64
) -> RandomIntegerRangeToInfinity 
Expand description

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

The mean bit length $m$ of the absolute values of the generated values is specified. $m$ is equal to mean_bits_numerator / mean_bits_denominator.

The output length is infinite.

§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_bits_numerator or mean_bits_denominator are zero, if $a < 0$ and their ratio is less than or equal to the bit length of $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::integer::random::random_integer_range_to_negative_infinity;
use malachite_nz::integer::Integer;

assert_eq!(
    prefix_to_string(
        random_integer_range_to_negative_infinity(EXAMPLE_SEED, Integer::from(1000), 10, 1),
        10
    ),
    "[6, 2, -1714, -235958584061012446, -455842, 514, -12, -14936760, 335, 99, ...]"
)