pub fn random_unsigned_inclusive_range<T: PrimitiveUnsigned>(
    seed: Seed,
    a: T,
    b: T
) -> RandomUnsignedInclusiveRange<T>
Expand description

Uniformly generates random unsigned integers in the closed interval $[a, b]$.

$a$ must be less than or equal to $b$.

$$ P(x) = \begin{cases} \frac{1}{b-a+1} & \text{if} \quad a \leq x \leq b, \\ 0 & \text{otherwise.} \end{cases} $$

The output length is infinite.

Expected complexity per iteration

Constant time and additional memory.

Panics

Panics if $a > b$.

Examples

use malachite_base::iterators::prefix_to_string;
use malachite_base::num::random::random_unsigned_inclusive_range;
use malachite_base::random::EXAMPLE_SEED;

assert_eq!(
    prefix_to_string(random_unsigned_inclusive_range::<u8>(EXAMPLE_SEED, 10, 19), 10),
    "[11, 17, 15, 14, 16, 14, 12, 18, 11, 17, ...]"
)