Struct rand::distributions::Cauchy [−][src]
pub struct Cauchy { /* fields omitted */ }
The Cauchy distribution Cauchy(median, scale)
.
This distribution has a density function:
f(x) = 1 / (pi * scale * (1 + ((x - median) / scale)^2))
Example
use rand::distributions::{Cauchy, Distribution}; let cau = Cauchy::new(2.0, 5.0); let v = cau.sample(&mut rand::thread_rng()); println!("{} is from a Cauchy(2, 5) distribution", v);
Methods
impl Cauchy
[src]
impl Cauchy
pub fn new(median: f64, scale: f64) -> Cauchy
[src]
pub fn new(median: f64, scale: f64) -> Cauchy
Construct a new Cauchy
with the given shape parameters
median
the peak location and scale
the scale factor.
Panics if scale <= 0
.
Trait Implementations
impl Clone for Cauchy
[src]
impl Clone for Cauchy
fn clone(&self) -> Cauchy
[src]
fn clone(&self) -> Cauchy
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Copy for Cauchy
[src]
impl Copy for Cauchy
impl Debug for Cauchy
[src]
impl Debug for Cauchy
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Distribution<f64> for Cauchy
[src]
impl Distribution<f64> for Cauchy
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f64
[src]
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f64
Generate a random value of T
, using rng
as the source of randomness.
ⓘImportant traits for DistIter<'a, D, R, T>fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
Self: Sized,
R: Rng,
[src]
ⓘImportant traits for DistIter<'a, D, R, T>
fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
Self: Sized,
R: Rng,
Create an iterator that generates random values of T
, using rng
as the source of randomness. Read more