Suppose that $X \sim \mathsf{Exp}(\lambda = 1)$ so that
$F_X(u) = 1 - e^{-u}.$ Then, after a little algebra
one has $F_X^{-1}(u) = -\ln(1-u).$
If you let $U \sim \mathsf{Unif}(0,1),$ then
$F_X^{-1}(U) \sim \mathsf{Exp}(1).$
This is a method for simulating a random variable $X$ by inverting its CDF (if feasible), and then transforming
a standard uniform random variable $U$ according to
the inverse CDF of of $X,$ sometimes known as the
quantile function of $X.$ [The output of a satisfactory pseudorandom number generator is essentially indistinguishable from independent realizations of
a standard uniform random variable.]
Demonstration in R:
set.seed(411) # for reproducibility
u = runif(10^5) # generate values from UNIF(0,1)
x = -log(1 - u) # quantile transform to get EXP(1)
hist(x, prob=T, ylim=c(0,1), br = 30, col="skyblue2")
curve(dexp(x), add=T, col="red", lwd=2, n = 10001)
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/qz7qS.png)
The first 5000 realizations of $X$ above
pass a Kolmogorv-Smirnov test for $\mathsf{Exp}(1).$
[The test can't accommodate more than 5000 values.]
ks.test(x[1:5000], "pexp", 1)
One-sample Kolmogorov-Smirnov test
data: x[1:5000]
D = 0.012407, p-value = 0.4248
alternative hypothesis: two-sided