Skip to main content

index

Function index 

Source
pub fn index<R: Rng + ?Sized>(rng: &mut R, ubound: usize) -> usize
Expand description

Draws an index uniformly from 0..ubound.

Sampling is done in 32 bits so that the result does not depend on the width of usize. Panics if ubound is 0 or exceeds u32::MAX.