Function smartnoise_runtime::utilities::noise::apply_snapping_noise [−][src]
pub fn apply_snapping_noise(
value: f64,
epsilon: f64,
b: f64,
enforce_constant_time: bool
) -> Result<(f64, f64)>
Apply noise to value according to the Snapping mechanism. Sensitivity is assumed to be 1 in L1 space.
Arguments
value
- Non-private value of the statistic to be privatized.epsilon
- Desired privacy guarantee.b
- Upper bound on function value being privatized.enforce_constant_time
- Whether or not to enforce the algorithm to run in constant time
Returns
Value of statistic with noise applied according to the Snapping mechanism.
Example
use smartnoise_runtime::utilities::noise::apply_snapping_noise; let value: f64 = 50.0; let epsilon: f64 = 1.0; let b: f64 = 100.0; let value = apply_snapping_noise(value, epsilon, b, false); println!("snapped value: {:?}", value.unwrap());