pub trait SampleDiscreteLaplaceLinear<P>: SampleGeometric<P> {
    // Required method
    fn sample_discrete_laplace_linear(
        shift: Self,
        scale: P,
        bounds: Option<(Self, Self)>
    ) -> Fallible<Self>;
}
Expand description

Sample from the censored two-sided geometric distribution.

Required Methods§

source

fn sample_discrete_laplace_linear( shift: Self, scale: P, bounds: Option<(Self, Self)> ) -> Fallible<Self>

Proof Definition

Sample from the censored two-sided geometric distribution with parameter scale. If bounds is None, there are no timing protections, and the support is:

    [Self::MIN, Self::MAX]

If bounds is Some, execution runs in constant time, and the support is

    [Self::MIN, Self::MAX] ∩ {shift ± {1, 2, 3, ..., trials}}

Tail probabilities accumulate at the extrema of the support.

Arguments
  • shift - Parameter to shift the output by
  • scale - Parameter to scale the output by
  • bounds - If Some, run the algorithm in constant time with both inputs and outputs clamped to this value.
Return

A draw from the two-sided censored geometric distribution defined above.

Example
use opendp::traits::samplers::SampleDiscreteLaplaceLinear;
let geom = u8::sample_discrete_laplace_linear(0, 0.1, Some((20, 30)));

Implementors§