pub fn random_unsigned_range<T: PrimitiveUnsigned>(
    seed: Seed,
    a: T,
    b: T
) -> RandomUnsignedRange<T>Notable traits for RandomUnsignedRange<T>impl<T: PrimitiveUnsigned> Iterator for RandomUnsignedRange<T> type Item = T;
Expand description

Uniformly generates random unsigned integers in the half-open interval $[a, b)$.

$a$ must be less than $b$. This function cannot create a range that includes T::MAX; for that, use random_unsigned_inclusive_range.

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

The output length is infinite.

Expected complexity per iteration

Constant time and additional memory.

Panics

Panics if $a \geq b$.

Examples

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

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