pub struct SeededRng { /* private fields */ }Expand description
A deterministic, snapshot/restore-able RNG for record-and-replay.
Backed by rand_chacha::ChaCha20Rng. Given the same seed and the same
number of draws, every instance produces the identical u64 sequence;
snapshot + restore reproduces the
remaining draws exactly, and split yields an
independent substream that does not perturb the parent.
Implementations§
Source§impl SeededRng
impl SeededRng
Sourcepub fn from_seed(seed: u64) -> Self
pub fn from_seed(seed: u64) -> Self
Construct from a 64-bit seed. The full 256-bit ChaCha key is
derived by zero-extending the seed (this is ChaCha20Rng::seed_from_u64).
Sourcepub fn snapshot(&self) -> RngState
pub fn snapshot(&self) -> RngState
Capture the current position so it can be restored
later to reproduce the identical subsequent draw sequence.
Auto Trait Implementations§
impl Freeze for SeededRng
impl RefUnwindSafe for SeededRng
impl Send for SeededRng
impl Sync for SeededRng
impl Unpin for SeededRng
impl UnsafeUnpin for SeededRng
impl UnwindSafe for SeededRng
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more