Crate stdrandom

Source
Expand description

§stdrandom

Random numbers generator using only Rust standard library.

This library have two types of generators:

  1. 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.
  2. 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’s RandomState.
fast_i16
Generates a non-negative i16 random number using the current thread’s RandomState.
fast_i32
Generates a non-negative i32 random number using the current thread’s RandomState.
fast_i64
Generates a non-negative i64 random number using the current thread’s RandomState.
fast_i128
Generates a non-negative i128 random number using two separate instances of RandomState.
fast_isize
Generates a non-negative isize random number using the current thread’s RandomState.
fast_u8
Generates a u8 random number using the current thread’s RandomState.
fast_u16
Generates a u16 random number using the current thread’s RandomState.
fast_u32
Generates a u32 random number using the current thread’s RandomState.
fast_u64
Generates a u64 random number using the current thread’s RandomState.
fast_u128
Generates a u128 random number using the current thread’s RandomStates.
fast_usize
Generates a usize random number using the current thread’s RandomState.
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.