Module rand_pcg
PCG family of fast, non-cryptographic random number generators.
- Crate
::rand_pcg. - docs.rs
- crates.io
- GitHub
rand_pcg provides random number generators based on the
PCG family of algorithms.
These are fast, have good statistical quality, and are portable —
given the same seed they produce identical output on all platforms.
They are not cryptographically secure.
Use rand_chacha when security matters.
The main types are:
Pcg32-- 32-bit output, 64-bit state. Good general-purpose default.Pcg64-- 64-bit output, 128-bit state. Better for generating 64-bit values.
Example
use SeedableRng;
use Rng;
use Pcg32;
let mut rng = seed_from_u64;
let value: u32 = rng.random;
let in_range: f64 = rng.random_range;
let coin: bool = rng.random;