The way to generate geometrically distributed random numbers is the following
$$\lfloor{\ln(u)/\ln(1-p)}\rfloor$$
where $u$ is uniformly distributed in $[0,1]$ and $p$ is the parameter in the geometric distribution.
But can anybody help provide a rigorous proof? I only see that $\ln(u)/\ln(1-p)$ is exponentially distributed, but how to get the geometric distribution?