# Struct rand_distr::Zeta

source · `pub struct Zeta<F>{ /* private fields */ }`

## Expand description

Samples integers according to the zeta distribution.

The zeta distribution is a limit of the `Zipf`

distribution. Sometimes it
is called one of the following: discrete Pareto, Riemann-Zeta, Zipf, or
Zipf–Estoup distribution.

It has the density function `f(k) = k^(-a) / C(a)`

for `k >= 1`

, where `a`

is the parameter and `C(a)`

is the Riemann zeta function.

## §Example

```
use rand::prelude::*;
use rand_distr::Zeta;
let val: f64 = thread_rng().sample(Zeta::new(1.5).unwrap());
println!("{}", val);
```

## §Remarks

The zeta distribution has no upper limit. Sampled values may be infinite. In particular, a value of infinity might be returned for the following reasons:

- it is the best representation in the type
`F`

of the actual sample. - to prevent infinite loops for very small
`a`

.

## §Implementation details

We are using the algorithm from Non-Uniform Random Variate Generation, Section 6.1, page 551.

## Implementations§

## Trait Implementations§

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

### impl<F> Distribution<F> for Zeta<F>

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

### impl<F> PartialEq for Zeta<F>

### impl<F> Copy for Zeta<F>

### impl<F> StructuralPartialEq for Zeta<F>

## Auto Trait Implementations§

### impl<F> RefUnwindSafe for Zeta<F>where
F: RefUnwindSafe,

### impl<F> Send for Zeta<F>where
F: Send,

### impl<F> Sync for Zeta<F>where
F: Sync,

### impl<F> Unpin for Zeta<F>where
F: Unpin,

### impl<F> UnwindSafe for Zeta<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