BHDr. Ben HartlageStats & Operations Analysis

Probability → simulation

One uniform draw.
Any distribution.

Start with a random number between 0 and 1. Read across the cumulative distribution, then down to find a simulated value.

The inverse transformU ∼ Uniform(0, 1)
↓
X = F⁻¹(U)
Same source of randomness.
A different shape of outcomes.

Choose the model

What are we simulating?

1 Start with uniform

Choose a probability.

Move the slider or enter an exact U to explore. Manual values are previews; only random draws enter the sample.

2 Invert the CDF

Across to the curve. Down to X.

Cumulative probability F(x) = P(X ≤ x)

3 Read the outcome

The distribution of X

Resulting value

Repeat the experiment

Watch the sample become the model.

Each new value begins with a fresh uniform draw. Blue shows theory; green shows the random sample.

Random draws0
Sample mean—
Theoretical mean
Sample SD—
Theoretical SD

Latest draws (newest first)
No random draws yet. Try “Draw one random U.”

Why it works

Probability becomes position.

For a continuous, strictly increasing CDF, F(X) = U. Because U fills the probability scale uniformly, the resulting X values follow the chosen distribution. A steep CDF assigns more draws to a small range of X.

F⁻¹(u) = inf {x : F(x) ≥ u}, for 0 < u < 1

Try it in class

Predict. Trace. Repeat.

  1. With Exponential, compare U = 0.50 and U = 0.95. Why does a small change near 1 create a large waiting time?
  2. Switch to Poisson. Move U slowly. Why can several probabilities generate the same whole-number count?
  3. Draw 1,000 values. Compare the sample with theory, then clear and repeat. Why are the samples different?
Endpoints, numerical methods, and references

Random draws use the midpoints of 2³² equally likely probability cells, so 0 and 1 are never drawn. For imported tables, 0 is included and 1 is excluded; imported-table bins use [lower, upper). Built-in models retain their usual quantile convention. For built-in models, the manual controls allow both endpoints to illustrate limits: Normal gives −∞ and +∞; Exponential gives 0 and +∞; Poisson with a positive mean gives 0 and +∞. Uniform and Binomial use their support limits. A zero-mean Poisson is always zero. Endpoint previews are never counted as random samples.

The Normal inverse is calculated numerically using a tail-stable CDF. Poisson uses a probability recurrence and a conservative tail cutoff; its mean is limited to 100 here. The CDF for a discrete distribution is a right-continuous step function: filled points belong to the step, open points do not. Dashed vertical jump guides are not additional attainable CDF values. Plots show a useful window and expand to include the current finite preview; the distribution itself is not truncated. Samples outside the visible window are reported below the plots.

Continuous histograms show count ÷ (total draws × bin width); discrete bars show count ÷ total draws. Sample SD uses n − 1. Changing the distribution or its parameters clears all samples. Up to 50,000 random draws can be held in this tab; refresh clears everything.

References: NIST: Exponential · NIST: Poisson · CDFs and generalized inverses