pub fn random_rationals_with_denominator_range_to_negative_infinity(
    seed: Seed,
    d: Natural,
    a: Rational,
    mean_numerator_bits_numerator: u64,
    mean_numerator_bits_denominator: u64
) -> RationalsWithDenominator<RandomIntegerRangeToInfinity> 
Expand description

Generates random Rationals less than or equal to a lower bound $a$ and with a specific denominator.

The mean bit length $m$ of the absolute values of the numerators of the generated values is specified. $m$ is equal to mean_numerator_bits_numerator / mean_numerator_bits_denominator.

The output length is infinite.

§Expected complexity per iteration

$T(n) = O(n (\log n)^2 \log\log n)$

$M(n) = O(n \log n)$

where $T$ is time, $M$ is additional memory, and $n$ is mean_numerator_bits_numerator / mean_numerator_bits_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::natural::Natural;
use malachite_q::random::random_rationals_with_denominator_range_to_negative_infinity;
use malachite_q::Rational;

assert_eq!(
    prefix_to_string(
        random_rationals_with_denominator_range_to_negative_infinity(
            EXAMPLE_SEED,
            Natural::from(3u32),
            Rational::from_unsigneds(3u32, 2),
            3,
            1
        ),
        10
    ),
    "[1/3, 4/3, -56/3, -2/3, 2/3, -1/3, -7/3, -11/3, -17/3, 4/3, ...]"
)