It is common to have a low-level Random number generator which generates uniform variates on $[0,1)$ and generate variates from other distributions by “processing” those variables. One very flexible but memory-intensive approach is to use look-up tables to convert them. For some distributions a simpler mathematical transformation method can be used. We list some of the most common below. In what follows, lowercase letters denote pseudo-random numbers on $[0,1)$.

Normal distribution

Generate $u$ and $v$ and set $U=2u-1$, $V=2v-1$.

Set $W=U^2+V^2$. If $W \gt 1$ restart from 1.

Set $A=\sqrt{(-2\log W)/W}$.

Values $T_1=U A$ and $T_2=V A$ are two independent variates from the Normal/Gaussian distribution.

Multivariate normal distribution

Generate $N$ independent standard normal random numbers, forming an $N$-vector $X$.

Set $V = LX + \mu$, where $L$ is the left Cholesky factor of the multivariate normal covariance matrix $\Sigma$ ($\Sigma\equiv LL^T$), and $\mu$ is the multivariate normal mean vector. The vector $V$ is a random sample from the distribution $N(\mu,\Sigma)$.

Student-$t$ distribution with $n$ degrees of freedom

Generate $u$ and $v$ and set $U=2u-1$, $V=2v-1$.

Set $W=U^2+V^2$. If $W \gt 1$ restart from 1.

Value $T=U\sqrt{n \frac{W^{-2/n}-1}{W}}$ is from the Student-$t$ distribution with $n$ degrees of freedom.

Cauchy distribution

Generate $u$ and $v$ and set $U=2u-1$, $V=2v-1$.

Set $W=U^2+V^2$. If $W \gt 1$ restart from 1.

Value $T=U\sqrt{\frac{W^{-2}-1}{W}}$ is from the Cauchy distribution.