pub fn get_striped_random_integer_from_range_to_infinity(
xs: &mut StripedBitSource,
range_generator: &mut VariableRangeGenerator,
a: Integer,
mean_bits_numerator: u64,
mean_bits_denominator: u64,
) -> IntegerExpand description
Generates a striped random Integer greater than or equal to a lower bound $a$.
The mean bit length $m$ of the Integer 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 Integer is 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.
See StripedBitSource for information about generating striped random numbers.
§Expected complexity
$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::num::random::striped::StripedBitSource;
use malachite_base::num::random::VariableRangeGenerator;
use malachite_base::random::EXAMPLE_SEED;
use malachite_nz::integer::random::get_striped_random_integer_from_range_to_infinity;
use malachite_nz::integer::Integer;
assert_eq!(
get_striped_random_integer_from_range_to_infinity(
&mut StripedBitSource::new(EXAMPLE_SEED.fork("bs"), 10, 1),
&mut VariableRangeGenerator::new(EXAMPLE_SEED.fork("rg")),
Integer::from(-1000),
20,
1
),
-3
);