laplace.h File Reference

Header for laplace.c. More...

#include "lib/cc/compat_compiler.h"
#include "lib/cc/torint.h"

Go to the source code of this file.


int64_t sample_laplace_distribution (double mu, double b, double p)
int64_t add_laplace_noise (int64_t signal, double random, double delta_f, double epsilon)

Detailed Description

Header for laplace.c.

Definition in file laplace.h.

Function Documentation

◆ add_laplace_noise()

int64_t add_laplace_noise ( int64_t  signal_,
double  random_,
double  delta_f,
double  epsilon 

Add random noise between INT64_MIN and INT64_MAX coming from a Laplace distribution with mu = 0 and b = delta_f/epsilon to signal based on the provided random value in [0.0, 1.0[. The epsilon value must be between ]0.0, 1.0]. delta_f must be greater than 0.

Definition at line 51 of file laplace.c.

◆ sample_laplace_distribution()

int64_t sample_laplace_distribution ( double  mu,
double  b,
double  p 

Transform a random value p from the uniform distribution in [0.0, 1.0[ into a Laplace distributed value with location parameter mu and scale parameter b. Truncate the final result to be an integer in [INT64_MIN, INT64_MAX].

Definition at line 26 of file laplace.c.

Referenced by add_laplace_noise().