Function smartnoise_runtime::utilities::mechanisms::laplace_mechanism [−][src]
pub fn laplace_mechanism(
value: f64,
epsilon: f64,
sensitivity: f64,
enforce_constant_time: bool
) -> Result<f64>
Returns noise drawn according to the Laplace mechanism
Noise is drawn with scale sensitivity/epsilon and centered about 0. For more information, see the Laplace mechanism in C. Dwork, A. Roth The Algorithmic Foundations of Differential Privacy, Chapter 3.3 The Laplace Mechanism p.30-37. August 2014.
NOTE: this implementation of Laplace draws is likely non-private due to floating-point attacks See Mironov (2012) for more information
Arguments
value
- Statistic to be privatized.epsilon
- Multiplicative privacy loss parameter.sensitivity
- Upper bound on the L1 sensitivity of the function you want to privatize.enforce_constant_time
- Whether or not to enforce the algorithm to run in constant time
Return
A single value drawn from the Laplace distribution with scale sensitivity/epsilon centered about 0.
Examples
use smartnoise_runtime::utilities::mechanisms::laplace_mechanism; let n = laplace_mechanism(22.3, 0.1, 2.0, false);