The Uniform Distribution
All equally likely.
The simplest continuous distribution is the uniform. Every value in a range is equally likely. A random number between zero and one, or a bus that arrives at any moment in the next ten minutes.

- Every value equally likely
- A random number from 0 to 1
- A bus in the next 10 minutes
A flat histogram
RNG dot uniform draws numbers evenly between a low and a high value. A histogram of a hundred thousand of them is flat. Run it. Every part of the range gets about the same number of values.
import numpy as np
import matplotlib.pyplot as plt
rng = np.random.default_rng(0)
wait = rng.uniform(0, 10, 100_000)
plt.hist(wait, bins=20)
plt.title("Bus wait (minutes)")
plt.savefig("uniform.png")Probability is width
For a continuous variable, the chance of any exact value, like exactly three point zero zero zero minutes, is zero. Instead, we ask about ranges. For a uniform wait from zero to ten minutes, the chance of waiting between two and five minutes is the width, three, divided by ten. Thirty percent.
| key | value |
|---|---|
| Uniform(a, b) | flat from a to b |
| Exact value | probability 0 |
| A range | width ÷ total width |
| 2 to 5 of 0 to 10 | 30% |
Summary
In a uniform distribution, every value in a range is equally likely, and probability is just width. Next, the most famous distribution of all, the normal.
Key takeaways- rng.uniform(a, b)
- Flat histogram
- Probability of a range