pub trait Sample {
// Required method
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f64;
// Provided method
fn sample_n(&self, n: usize, seed: u64) -> Vec<f64> { ... }
}Expand description
A distribution that can draw random variates.
§Examples
use u_numflow::distributions::{Sample, Weibull};
let w = Weibull::new(2.0, 100.0).unwrap();
let a = w.sample_n(1000, 42);
assert_eq!(a, w.sample_n(1000, 42)); // same seed, same draws
assert!(a.iter().all(|&t| t > 0.0 && t.is_finite()));Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".