pub fn get_uniform_random_integer_from_range(
limbs: &mut RandomPrimitiveInts<u64>,
a: Integer,
b: Integer,
) -> IntegerExpand description
Generates a random Integer in the half-open interval $[a, b)$.
The Integer is chosen uniformly from the interval.
$$
P(n) = \begin{cases}
1/(b-a) & \text{if} a\leq n<b, \\
0 & \text{otherwise},
\end{cases}
$$
where $\ell$ is limit.
§Expected complexity
$T(n) = O(n)$
$M(m) = O(m)$
where $T$ is time, $M$ is additional memory, $n$ is mean_bits_numerator + mean_bits_denominator, and $m$ is max(a.significant_bits(), b.significant_bits()).
§Examples
use malachite_base::num::random::random_primitive_ints;
use malachite_base::random::EXAMPLE_SEED;
use malachite_nz::integer::random::get_uniform_random_integer_from_range;
use malachite_nz::integer::Integer;
assert_eq!(
get_uniform_random_integer_from_range(
&mut random_primitive_ints(EXAMPLE_SEED),
Integer::from(500u32),
Integer::from(1000u32)
),
869
);