pub struct SeededSampler { /* private fields */ }Expand description
A public deterministic sampler with explicit version, work, state and forks.
fork(label) is domain-separated from both the root stream and other labels;
it never consumes its parent. Existing consumers use the root stream and thus
retain their historical SplitMix64-v1 output exactly.
Implementations§
Source§impl SeededSampler
impl SeededSampler
Sourcepub fn new(seed: u64) -> Self
pub fn new(seed: u64) -> Self
Constructs an unbounded root stream. Algorithms should preflight their
own exact work or use Self::with_max_words for refusal.
Sourcepub fn with_max_words(seed: u64, max_words: u64) -> Self
pub fn with_max_words(seed: u64, max_words: u64) -> Self
Constructs a root stream that refuses generation beyond max_words.
Sourcepub fn replay(receipt: SamplerReceipt) -> Self
pub fn replay(receipt: SamplerReceipt) -> Self
Restores a canonical state and word allowance.
Sourcepub fn receipt(&self) -> SamplerReceipt
pub fn receipt(&self) -> SamplerReceipt
Captures a replay receipt.
Sourcepub fn fork(&self, label: u64) -> Self
pub fn fork(&self, label: u64) -> Self
Returns an independent, deterministic labeled substream without advancing this stream.
Sourcepub fn try_next_u64(&mut self) -> Result<u64, DesignError>
pub fn try_next_u64(&mut self) -> Result<u64, DesignError>
Produces the next word, refusing when the declared allowance is spent.
Sourcepub fn unit_interval(&mut self) -> f64
pub fn unit_interval(&mut self) -> f64
Maps one word to [0, 1) using the stable 53-bit convention.
Trait Implementations§
Source§impl Clone for SeededSampler
impl Clone for SeededSampler
Source§fn clone(&self) -> SeededSampler
fn clone(&self) -> SeededSampler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more