Trac issueshttps://gitlab.torproject.org/legacy/trac/-/issues2020-06-13T15:13:20Zhttps://gitlab.torproject.org/legacy/trac/-/issues/23415sample_laplace_distribution() should take multiple random inputs2020-06-13T15:13:20Zteorsample_laplace_distribution() should take multiple random inputsCurrently, sample_laplace_distribution() takes a random double as input, and then extracts the following random values:
* a random sign
* a random value in (0.0, 1.0]
This reduces the precision of the result. For details, see:
https://t...Currently, sample_laplace_distribution() takes a random double as input, and then extracts the following random values:
* a random sign
* a random value in (0.0, 1.0]
This reduces the precision of the result. For details, see:
https://trac.torproject.org/projects/tor/ticket/23061#comment:32
Instead, the function could take a random boolean sign and p, and the transform becomes:
```
result = mu - b * (sign ? 1.0 : -1.0)
* tor_mathlog(1.0 - p);
```
This would increase the precision by one bit, plus whatever precision is lost in `2.0 * fabs(p - 0.5)`.
This may have been introduced in dad5eb7.Tor: unspecifiedhttps://gitlab.torproject.org/legacy/trac/-/issues/23323sample_laplace_distribution should produce a valid result on 0.02020-06-13T15:13:02Zteorsample_laplace_distribution should produce a valid result on 0.0Destroying the signal with probability 1 in 2^-53^ isn't a great idea.
Let's pick a sensible double value, and pass it through the function instead.
I suggest 2^-54^, but it really doesn't matter exactly what value we use, as long as it...Destroying the signal with probability 1 in 2^-53^ isn't a great idea.
Let's pick a sensible double value, and pass it through the function instead.
I suggest 2^-54^, but it really doesn't matter exactly what value we use, as long as it produces valid results, because the probability is so low.
Introduced in 45bc5a0Tor: unspecified