Struct rand_simple::Cauchy
source · pub struct Cauchy { /* private fields */ }Expand description
Cauchy Distribution
Example
let mut cauchy = rand_simple::Cauchy::new(1192_u32);
assert_eq!(format!("{cauchy}"), "Ca(Location parameter, Scale parameter) = Ca(0, 1)");
println!("Returns a random number -> {}", cauchy.sample());
// When changing the parameters of the random variable
let location: f64 = -2_f64;
let scale: f64 = 1.5_f64;
let result: Result<(f64, f64), &str> = cauchy.try_set_params(location, scale);
assert_eq!(format!("{cauchy}"), "Ca(Location parameter, Scale parameter) = Ca(-2, 1.5)");
println!("Returns a random number -> {}", cauchy.sample());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Cauchy
impl Send for Cauchy
impl Sync for Cauchy
impl Unpin for Cauchy
impl UnwindSafe for Cauchy
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