pub struct Sampler { /* private fields */ }Expand description
Thread-local statistical distribution sampler backed by a high-quality PRNG.
Implementations§
Source§impl Sampler
impl Sampler
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new sampler instance with a thread-local pseudorandom number generator.
Sourcepub fn sample_standard_normal(&mut self) -> f64
pub fn sample_standard_normal(&mut self) -> f64
Generates a single sample from the standard normal distribution N(0, 1).
Sourcepub fn gamma(&mut self, shape: f64, scale: f64) -> f64
pub fn gamma(&mut self, shape: f64, scale: f64) -> f64
Gamma(shape, scale). Preconditions: shape > 0, scale > 0.
Sourcepub fn chi2(&mut self, df: f64) -> f64
pub fn chi2(&mut self, df: f64) -> f64
Chi-square(df) == Gamma(df/2, 2). Preconditions: df > 0.
Sourcepub fn standard_normal_vec(&mut self, dim: usize) -> Vec64<f64>
pub fn standard_normal_vec(&mut self, dim: usize) -> Vec64<f64>
Vector of iid N(0,1) samples of length dim.
Auto Trait Implementations§
impl Freeze for Sampler
impl !RefUnwindSafe for Sampler
impl !Send for Sampler
impl !Sync for Sampler
impl Unpin for Sampler
impl !UnwindSafe for Sampler
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