[][src]Function sodiumoxide::randombytes::randombytes_uniform

pub fn randombytes_uniform(upper_bound: u32) -> u32

randombytes_uniform() returns an unpredictable value between 0 and upper_bound (excluded). It guarantees a uniform distribution of the possible output values even when upper_bound is not a power of 2. Note that an upper_bound < 2 leaves only a single element to be chosen, namely 0.

THREAD SAFETY: randombytes() is thread-safe provided that you have called sodiumoxide::init() once before using any other function from sodiumoxide.