Sample from a Laplace distribution with location 0 and scale 1.
Uses inverse transform sampling: the CDF is F(x) = 0.5 + 0.5 * sign(x) * (1 - exp(-|x|)). Inverting: x = -sign(u - 0.5) * log(1 - 2 * |u - 0.5|).
F(x) = 0.5 + 0.5 * sign(x) * (1 - exp(-|x|))
x = -sign(u - 0.5) * log(1 - 2 * |u - 0.5|)
Sample from a Laplace distribution with location 0 and scale 1.
Uses inverse transform sampling: the CDF is
F(x) = 0.5 + 0.5 * sign(x) * (1 - exp(-|x|)). Inverting:x = -sign(u - 0.5) * log(1 - 2 * |u - 0.5|).