[−][src]Crate random_fast_rng
Random-fast-rng
This crate provides a fast non cryptographic random number generator that implements the Random
trait.
Currently it's implemented using the Pcg32
algorithm, that generates 32 bit of random data for every state change.
the exact algorithm might change in the future, but the properties should stay the same (Blazing fast, non cryptographic, and minimal I/O)
The crate is part of the random-rs
facade, and as such supports older rust compilers(currently 1.13+) and should have only thin amount of dependencies.
This Random generator is good for testing uses, and use cases that require some non-determinism. it shouldn't be used to generate keys/passwords.
By enabling the std
feature this crate exposes a new()
function that uses SystemTime::now()
to seed the RNG.
It also exposes a local_rng()
function to give a persistent Rng that is seeded only once and is unique per thread (so there's no need to worry about dropping and reinitializing the Rng)
Re-exports
pub extern crate random_trait; |
Structs
FastRng | A FastRng struct implementing |
ThreadFastRng | A shim that points to the global |
Traits
Random | This is the base trait of the crate. By implementing the required method on your random generator source
it will give you a long list of functions, the important of them is |
Functions
local_rng | Returns a thread local instance which is seeded only once per thread (no need to worry about dropping and reinitializing) |