Function smartnoise_runtime::utilities::mechanisms::snapping_mechanism[][src]

pub fn snapping_mechanism(
    value: f64,
    epsilon: f64,
    sensitivity: f64,
    min: f64,
    max: f64,
    binding_probability: Option<f64>,
    enforce_constant_time: bool
) -> Result<f64>

Computes privatized value according to the Snapping mechanism

Developed as a variant of the Laplace mechanism which does not suffer from floating-point side channel attacks. For more information, see Mironov (2012)

Arguments

Returns

Result of snapping mechanism

Example

use smartnoise_runtime::utilities::mechanisms::snapping_mechanism;
let value: f64 = 50.0;
let epsilon: f64 = 1.0;
let min: f64 = -50.;
let max: f64 = 150.0;
let sensitivity: f64 = 1.0/1000.0;
let precision: i64 = 118;
snapping_mechanism(value, epsilon, sensitivity, min, max, None, false).unwrap();
println!("snapped value: {}", value);