pub fn sample_discrete_laplace(scale: Rational) -> Fallible<Integer>
Expand description

Sample exactly from the discrete laplace distribution with arbitrary precision.

Proof Definition

(Proof Document) For any scale that is a non-negative rational number, sample_discrete_laplace either returns Err(e) due to a lack of system entropy, or Ok(out), where out is distributed as $\mathcal{L}_\mathbb{Z}(0, scale)$.

Specifically, the probability of returning any x of type rug::Integer is

\forall x \in \mathbb{Z}, \quad  
P[X = x] = \frac{e^{-1/scale} - 1}{e^{-1/scale} + 1} e^{-|x|/scale}, \quad
\text{where } X \sim \mathcal{L}_\mathbb{Z}(0, scale)

Citation