# Sampling from Continuous Distributions

Here, we show how computers generate random samples from arbitrary continuous distributions.

The technique is called inverse sampling , and it works by first generating a sample from an Uniform(0,1) distribution, and then uses the invertibility of the CDF to generate a sample from the initial distribution. If $F^{-1}$ is the inverse CDF, then if $y$ is a random sample from the uniform, then $F^{-1}(y)$ is a sample from the original distribution.

In this visualization, a circle (our random uniform sample ) starts from the y-axis and travels two paths: one down to the x-axis to form our original distribution, and another straight ahead to form a uniform distribution. Once you've got the gist, press Toggle Speed and watch the distribution come up

Note: This visualization best works on wide screens, so if you're on mobile, try landscape.

Thanks to Andy Palan for testing the visualizations and providing feedback!