Expand description
§Synopsis
The PCG crate is a port of the C/C++ PCG library for generating random
numbers. It implements the RngCore
trait so all of the standard Rust methods
for generating random numbers are available. You can find a reference on the methods provided
by the Rng
trait here: https://rust-random.github.io/rand/rand/trait.Rng.html
Note: you must use the rand
crate if you want to use the methods provided
by the Rng
trait.
use rand::prelude::*;
use pcg::Pcg;
// Create the PCG struct with state
let mut pcg = Pcg::default();
// Generate arbitrary random values
let mut some_bool: bool = pcg.gen();
let mut some_f32: f32 = pcg.gen();
let mut some_u32: u32 = pcg.gen();