pub struct Laplace { /* private fields */ }Expand description
Laplace Distribution
§Example
let mut laplace = rand_simple::Laplace::new(1192u32);
assert_eq!(format!("{laplace}"), "La(Location parameter, Scale parameter) = La(0, 1)");
println!("Returns a random number -> {}", laplace.sample());
// Modify the distribution's parameters
let location: f64 = -2f64;
let scale: f64 = 1.5f64;
let result: Result<(f64, f64), &str> = laplace.try_set_params(location, scale);
assert_eq!(format!("{laplace}"), "La(Location parameter, Scale parameter) = La(-2, 1.5)");
println!("Returns a random number -> {}", laplace.sample());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Laplace
impl RefUnwindSafe for Laplace
impl Send for Laplace
impl Sync for Laplace
impl Unpin for Laplace
impl UnwindSafe for Laplace
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