Trait opendp::samplers::SampleTwoSidedGeometric[][src]

pub trait SampleTwoSidedGeometric: SampleGeometric {
    fn sample_two_sided_geometric(
        shift: Self,
        scale: f64,
        bounds: Option<(Self, Self)>
    ) -> Fallible<Self>; }

Required methods

Sample from the censored two-sided geometric distribution with parameter prob. 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 of the uncensored two-sided geometric 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::samplers::SampleTwoSidedGeometric;
let geom = u8::sample_two_sided_geometric(0, 0.1, Some((20, 30)));

Implementors