Function gym_rs::utils::seeding::rand_random

source ·
pub fn rand_random(seed: Option<u64>) -> (Pcg64, u64)
Expand description

Generates a PRNG using the PCG64 algorithm.

Returns the PRNG instance along with the seed number used to initiate the generator.

Examples

use gym_rs::utils::seeding::rand_random;

// Generates a PRNG using a random seed derived from the OS.
rand_random(None);

// Generates a PRNG using the given seed.
let (generator, seed_no) = rand_random(Some(64));
assert_eq!(seed_no, 64);