Struct rand_distr::Cauchy [−][src]
pub struct Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>, { /* fields omitted */ }
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
impl<F> Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>,
[src]
impl<F> Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>,
[src]Trait Implementations
impl<F: Clone> Clone for Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>,
[src]
impl<F: Clone> Clone for Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>,
[src]impl<F: Debug> Debug for Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>,
[src]
impl<F: Debug> Debug for Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>,
[src]impl<F> Distribution<F> for Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>,
[src]
impl<F> Distribution<F> for Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>,
[src]impl<F: Copy> Copy for Cauchy<F> where
F: Float + FloatConst,
Standard: Distribution<F>,
[src]
F: Float + FloatConst,
Standard: Distribution<F>,
Auto Trait Implementations
impl<F> RefUnwindSafe for Cauchy<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for Cauchy<F> where
F: Send,
F: Send,
impl<F> Sync for Cauchy<F> where
F: Sync,
F: Sync,
impl<F> Unpin for Cauchy<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for Cauchy<F> where
F: UnwindSafe,
F: UnwindSafe,