Expand description
§stdrandom
Random numbers generator using only Rust standard library.
This library have two types of generators:
- fast_ - these generators are fast but less random. They have progressively lowering entropy because they are based on incrementing seed. This is weakness of standard Rust library. Better is use one of these random numbers as seed for more reliable random number generator, even MCG will do better job.
- random_ - these generators needs to spawn a new thread to obtain high quality randomness. This randomness is pretty good and passes benchmarks for random number generators with a good score. While it is still not crypto secure random for using in things like generating key material it will resist common attacks well.
Functions§
- fast_
f32 - Generates a fast but lower-entropy
f32pseudo-random number in the range[0.0, 1.0). - fast_
f64 - Generates a fast but lower-entropy
f64pseudo-random number in the range[0.0, 1.0). - fast_i8
- Generates a non-negative
i8random number using the current thread’sRandomState. - fast_
i16 - Generates a non-negative
i16random number using the current thread’sRandomState. - fast_
i32 - Generates a non-negative
i32random number using the current thread’sRandomState. - fast_
i64 - Generates a non-negative
i64random number using the current thread’sRandomState. - fast_
i128 - Generates a non-negative
i128random number using two separate instances ofRandomState. - fast_
isize - Generates a non-negative
isizerandom number using the current thread’sRandomState. - fast_u8
- Generates a
u8random number using the current thread’sRandomState. - fast_
u16 - Generates a
u16random number using the current thread’sRandomState. - fast_
u32 - Generates a
u32random number using the current thread’sRandomState. - fast_
u64 - Generates a
u64random number using the current thread’sRandomState. - fast_
u128 - Generates a
u128random number using the current thread’sRandomStates. - fast_
usize - Generates a
usizerandom number using the current thread’sRandomState. - fill_
bytes - Fills buffer with random bytes generated by the provided function.
- fill_
numbers - Fills a slice with generated numbers using the provided generator function.
- fill_
range - Fills a mutable slice with random numbers in the specified range using the supplied generator.
- gen_
range - Generates random number in specified range using supplied generator.
- random_
f32 - Generates a higher entropy
f32pseudo-random number in the range[0.0, 1.0). - random_
f64 - Generates a higher entropy
f64pseudo-random number in the range[0.0, 1.0). - random_
i8 - Generates a higher entropy pseudo-random
i8number. - random_
i16 - Generates a higher entropy pseudo-random
i16number. - random_
i32 - Generates a higher entropy pseudo-random
i32number. - random_
i64 - Generates a higher entropy pseudo-random
i64number. - random_
i128 - Generates a higher entropy pseudo-random
i128number using two separate threads. - random_
isize - Generates a higher entropy pseudo-random
isizenumber. - random_
u8 - Generates a higher entropy random
u8number in a separate thread. - random_
u16 - Generates a higher entropy random
u16number in a separate thread. - random_
u32 - Generates a higher entropy random
u32number in a separate thread. - random_
u64 - Generates a higher entropy pseudo-random
u64number. - random_
u128 - Generates a higher entropy random
u128number using two separate threads. - random_
usize - Generates a higher entropy pseudo-random
usizenumber.