pub fn get_striped_random_integer_from_range(
xs: &mut StripedBitSource,
range_generator: &mut VariableRangeGenerator,
a: Integer,
b: Integer,
) -> IntegerExpand description
Generates a random striped Integer in the range $[a, b)$.
Because the Integer is 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.
See StripedBitSource for information about generating striped random numbers.
§Expected complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is max(a.significant_bits(), b.significant_bits()).
§Panics
Panics if $a \geq b$.
§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;
use malachite_nz::integer::Integer;
assert_eq!(
get_striped_random_integer_from_range(
&mut StripedBitSource::new(EXAMPLE_SEED.fork("bs"), 10, 1,),
&mut VariableRangeGenerator::new(EXAMPLE_SEED.fork("rg")),
Integer::from(-4),
Integer::from(7),
),
-4
);