Uniform Distribution Calculator
For a uniform distribution between a and b, find the probability of a value at or below x, (x − a)/(b − a), and the flat density 1/(b − a).
Uniform Distribution Calculator
Background.
Some uncertainty has no favourite value. Someone who turns up at a stop served by a bus every ten minutes, without checking the timetable, is as likely to wait 1 minute as 9. A random number generator asked for a value between 0 and 1 should hand out every stretch of that interval in equal measure. A reading rounded to the nearest whole unit hides an error anywhere within half a unit either side, with no reason to suspect one part of that range more than another.
The continuous uniform distribution models all of these. Probability is spread evenly between a lower bound a and an upper bound b, so its density graph is a flat-topped rectangle, and the chance of landing in any stretch depends only on how long the stretch is. A window covering 30% of the range collects 30% of the probability, wherever it sits.
That makes the arithmetic short. The density, the height of the rectangle, is 1 ÷ (b − a). The cumulative probability, the chance of a value at or below some x, is the fraction of the range lying to the left of x: (x − a) ÷ (b − a). The probability of any window follows by subtraction.
The uniform model is also the honest default when all you know about something is its limits. Measurement scientists use it for an error quoted only as plus or minus a tolerance, and simulation software starts from uniform random numbers and transforms them into the other distributions it needs.
The page works with non-negative values: a must be zero or more, x and b must be positive, and x has to lie inside the interval. For a range that crosses zero, shift all three values up by the same amount first.
What is uniform distribution calculator?
The continuous uniform distribution, written U(a, b), describes a random quantity that can take any value between a and b, with the same density everywhere in that range and none outside it. Its density graph is a rectangle of width b − a and height 1 ÷ (b − a), so the total area, which is the total probability, is exactly 1. Its mean is the midpoint (a + b) ÷ 2 and its standard deviation is (b − a) ÷ √12.
How to use this calculator.
- Enter the smallest possible value as lower bound a and the largest as upper bound b, in whatever unit the quantity uses — minutes, millimetres, dollars.
- Enter the value x you are asking about. The page reports the probability of a result at or below x; subtract it from 1 for the probability of a result above x.
- For the chance of landing between two values, run the page once for each and subtract the smaller cumulative probability from the larger.
- If your range includes negative numbers, add the same constant to a, b and x so that all three are non-negative; the probabilities are unchanged by the shift.
The formula.
Two formulas, both valid for a ≤ x ≤ b. The density is f(x) = 1 ÷ (b − a), a constant because no value is favoured, and sized so the rectangle beneath it has an area of exactly 1. The cumulative distribution function is F(x) = (x − a) ÷ (b − a), the share of the interval's length lying at or below x. F climbs in a straight line from 0 at the lower bound to 1 at the upper bound, gaining the same amount for every unit x advances. The width b − a governs everything: halve it and the density doubles, so each unit step in x carries twice the probability. Below a the cumulative probability would be 0 and above b it would be 1, but the page asks for an x between the bounds rather than returning those trivial values. Density is measured per unit of x, such as per minute or per millimetre, and is not a probability by itself.
A worked example.
A bus runs every 10 minutes and you reach the stop at a random moment, so your wait is uniform between a = 0 and b = 10 minutes. The density is 1 ÷ (10 − 0) = 0.1 per minute: each minute of the range carries a tenth of the probability. The chance of waiting 4 minutes or less is (4 − 0) ÷ (10 − 0) = 4 ÷ 10 = 0.4, a 40% chance. The rest follows by subtraction. Waiting longer than 4 minutes has probability 1 − 0.4 = 0.6. Waiting between 4 and 7 minutes is F(7) − F(4) = 0.7 − 0.4 = 0.3. On average you wait the midpoint, 5 minutes, with a standard deviation of 10 ÷ √12, about 2.887 minutes.
Frequently asked questions.
Why can the probability density come out greater than 1?
Can I use this for the roll of a die?
What is the probability of getting exactly 4?
How do I turn a ± tolerance into a standard uncertainty?
How can I tell whether my data really are uniform?
Why won't the page accept a negative lower bound?
References& sources.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 3 cited below
- Method
- f(x)=1/(b-a); F(x)=(x-a)/(b-a), a≤x≤b
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled