Struct rand_distr::Cauchy
source · pub struct Cauchy<F>{ /* private fields */ }
Expand description
The Cauchy distribution Cauchy(median, scale)
.
This distribution has a density function:
f(x) = 1 / (pi * scale * (1 + ((x - median) / scale)^2))
Note that at least for f32
, results are not fully portable due to minor
differences in the target system’s tan implementation, tanf
.
§Example
use rand_distr::{Cauchy, Distribution};
let cau = Cauchy::new(2.0, 5.0).unwrap();
let v = cau.sample(&mut rand::thread_rng());
println!("{} is from a Cauchy(2, 5) distribution", v);
Implementations§
Trait Implementations§
source§impl<F> Distribution<F> for Cauchy<F>
impl<F> Distribution<F> for Cauchy<F>
impl<F> Copy for Cauchy<F>
Auto Trait Implementations§
impl<F> Freeze for Cauchy<F>where
F: Freeze,
impl<F> RefUnwindSafe for Cauchy<F>where
F: RefUnwindSafe,
impl<F> Send for Cauchy<F>where
F: Send,
impl<F> Sync for Cauchy<F>where
F: Sync,
impl<F> Unpin for Cauchy<F>where
F: Unpin,
impl<F> UnwindSafe for Cauchy<F>where
F: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)