pub struct DeterministicEnv { /* private fields */ }Expand description
The four-knob deterministic bundle handed to a vector run.
Construct with DeterministicEnv::from_seed; pass clones into each
party. The RNG is the only piece that must not be shared between
parties — give each party its own fork via DeterministicEnv::fork
so their streams diverge deterministically by party index.
Implementations§
Source§impl DeterministicEnv
impl DeterministicEnv
Sourcepub fn from_seed(seed: u64) -> Self
pub fn from_seed(seed: u64) -> Self
Build an env rooted at seed. All forked RNGs derive from this.
pub fn seed(&self) -> u64
Sourcepub fn rng_for(&self, party_idx: usize) -> DeterministicRng
pub fn rng_for(&self, party_idx: usize) -> DeterministicRng
A fresh RNG for party idx. Mixing the party index into the seed
means two parties never share a stream but the assignment is
still deterministic for a given (env seed, roster).
Sourcepub fn fork(&self, party_idx: usize) -> ForkedEnv<'_>
pub fn fork(&self, party_idx: usize) -> ForkedEnv<'_>
Fork this env for a child party: shares the clock and memory counter (those are session-wide) but yields a party-specific RNG.
pub fn clock(&self) -> &DeterministicClock
pub fn memory(&self) -> &MemoryCounter
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DeterministicEnv
impl !RefUnwindSafe for DeterministicEnv
impl !Sync for DeterministicEnv
impl Send for DeterministicEnv
impl Unpin for DeterministicEnv
impl UnsafeUnpin for DeterministicEnv
impl UnwindSafe for DeterministicEnv
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