= Solution
For rate $\lambda>0$, the <exponential distribution> has <cumulative distribution function> $F(x)=1-e^{-\lambda x}$ on $x\geq0$. <Inverse transform sampling> gives $-\log(1-U)/\lambda$; since $1-U$ is also uniform, an equivalent answer is
$$
\boxed{E=-\log U/\lambda.}
$$
For $x\geq0$, $P(E>x)=P(U<e^{-\lambda x})=e^{-\lambda x}$, verifying the <exponential distribution> directly.
The centered <Laplace distribution> with density $(\lambda/2)e^{-\lambda|x|}$ can be obtained by multiplying $E$ by an independent sign taking $1$ and $-1$ with equal probabilities. Alternatively, its <inverse transform sampling> formula uses just one uniform variate:
$$
\boxed{L=\begin{cases}\log(2U)/\lambda,&0<U<1/2,\\-\log(2(1-U))/\lambda,&1/2\leq U<1.\end{cases}}
$$
The first branch inverts the negative half of the <cumulative distribution function> and the second branch inverts the positive half. Add a location parameter if a noncentered <Laplace distribution> is wanted.
\b[Correct uniformity is essential for each marginal distribution, and independence is essential for independent samples and for the sign construction.] For example, setting every $U_i$ equal to a single uniform $U$ gives uniform marginals but identical transformed draws. Likewise, choosing a sign from the same uniform used for the magnitude can change the <Laplace distribution> unless the one-uniform inverse above is used.
Back to article page