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
f32
pseudo-random number in the range[0.0, 1.0)
. - fast_
f64 - Generates a fast but lower-entropy
f64
pseudo-random number in the range[0.0, 1.0)
. - fast_i8
- Generates a non-negative
i8
random number using the current thread’sRandomState
. - fast_
i16 - Generates a non-negative
i16
random number using the current thread’sRandomState
. - fast_
i32 - Generates a non-negative
i32
random number using the current thread’sRandomState
. - fast_
i64 - Generates a non-negative
i64
random number using the current thread’sRandomState
. - fast_
i128 - Generates a non-negative
i128
random number using two separate instances ofRandomState
. - fast_
isize - Generates a non-negative
isize
random number using the current thread’sRandomState
. - fast_u8
- Generates a
u8
random number using the current thread’sRandomState
. - fast_
u16 - Generates a
u16
random number using the current thread’sRandomState
. - fast_
u32 - Generates a
u32
random number using the current thread’sRandomState
. - fast_
u64 - Generates a
u64
random number using the current thread’sRandomState
. - fast_
u128 - Generates a
u128
random number using the current thread’sRandomState
s. - fast_
usize - Generates a
usize
random 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
f32
pseudo-random number in the range[0.0, 1.0)
. - random_
f64 - Generates a higher entropy
f64
pseudo-random number in the range[0.0, 1.0)
. - random_
i8 - Generates a higher entropy pseudo-random
i8
number. - random_
i16 - Generates a higher entropy pseudo-random
i16
number. - random_
i32 - Generates a higher entropy pseudo-random
i32
number. - random_
i64 - Generates a higher entropy pseudo-random
i64
number. - random_
i128 - Generates a higher entropy pseudo-random
i128
number using two separate threads. - random_
isize - Generates a higher entropy pseudo-random
isize
number. - random_
u8 - Generates a higher entropy random
u8
number in a separate thread. - random_
u16 - Generates a higher entropy random
u16
number in a separate thread. - random_
u32 - Generates a higher entropy random
u32
number in a separate thread. - random_
u64 - Generates a higher entropy pseudo-random
u64
number. - random_
u128 - Generates a higher entropy random
u128
number using two separate threads. - random_
usize - Generates a higher entropy pseudo-random
usize
number.