Struct rand_simple::HalfNormal
source · pub struct HalfNormal { /* private fields */ }Expand description
Half Normal Distribution
Example
let mut half_normal = rand_simple::HalfNormal::new([1192_u32, 765_u32]);
assert_eq!(format!("{half_normal}"), "HN(Std^2) = HN(1^2)");
println!("Returns a random number -> {}", half_normal.sample());
// If you want to change the parameters of the random variable
let variance: f64 = 2_f64;
let result: Result<f64, &str> = half_normal.try_set_params(variance);
assert_eq!(format!("{half_normal}"), "HN(Std^2) = HN(2^2)");
println!("Returns a random number -> {}", half_normal.sample());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for HalfNormal
impl Send for HalfNormal
impl Sync for HalfNormal
impl Unpin for HalfNormal
impl UnwindSafe for HalfNormal
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