Skip to main content

random_range

Function random_range 

Source
pub fn random_range(min: u64, max: u64) -> Result<u64, CryptoError>
Expand description

Generate a random integer in [min, max) using rejection sampling to eliminate modulo bias.

Returns CryptoError::BadInput if min >= max.

ยงNote

The old single-argument form random_range(max) has been renamed to random_range_to. Any existing callers should update to the two-argument form or use random_range_to explicitly.