Splittable

Trait Splittable 

Source
pub trait Splittable: PRNGenerator {
    // Required method
    fn split(&mut self) -> Self;
}
Expand description

A trait for splittable PRNGs. This means that given PRNG can split into two generators. This is different from creating a new PRNG (with a random seed), because splitting is a deterministic process.

Also this is different from cloning, since clones generally generate the same sequences of numbers (since clones have the exact same state). We want the result of splitting look like it is independent (even though in reality it is not).

It is especially useful for deterministic, multi-threaded simulations where each thread needs a PRNG.

Required Methods§

Source

fn split(&mut self) -> Self

Create a new PRNG from the current one. In a deterministic, yet non-obvious (pseudo random) way.

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§