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