Trait SeedableGenerator

Source
pub trait SeedableGenerator {
    // Required method
    fn new_with_seed(seed: u64) -> Self;
}

Required Methods§

Source

fn new_with_seed(seed: u64) -> Self

Creates a generator from the output of an internal SplitMix64 generator, which is itself seeded using seed.

As a rule: unless you are absolutely certain that you need to manually seed a generator, you don’t. Instead, use crate::new_rng when you need to create a new instance.

If you have a scenario where you really need a set seed, prefer to use the Default implementation of the desired generator.

§Examples
use ya_rand::*;

let mut rng1 = ShiroRng::new_with_seed(0);
let mut rng2 = ShiroRng::default();
// Default is just a shortcut for manually seeding with 0.
assert!(rng1 == rng2);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§