# 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<'de, F> Deserialize<'de> for Cauchy<F>

### impl<'de, F> Deserialize<'de> for Cauchy<F>

source§#### fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,

#### fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

source§### impl<F> Distribution<F> for Cauchy<F>

### impl<F> Distribution<F> for Cauchy<F>

source§### impl<F> PartialEq for Cauchy<F>

### impl<F> PartialEq for Cauchy<F>

### impl<F> Copy for Cauchy<F>

### impl<F> StructuralPartialEq 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