Tor
0.4.7.0-alpha-dev
|
Implements a Laplace distribution, used for adding noise to things. More...
#include "orconfig.h"
#include "lib/math/laplace.h"
#include "lib/math/fp.h"
#include "lib/log/util_bug.h"
#include <math.h>
#include <stdlib.h>
Go to the source code of this file.
Functions | |
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) |
Implements a Laplace distribution, used for adding noise to things.
Definition in file laplace.c.
int64_t add_laplace_noise | ( | int64_t | signal_, |
double | random_, | ||
double | delta_f, | ||
double | epsilon | ||
) |
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().