The uniform distribution calculator handles the simplest probability model there is: every outcome in a range is exactly as likely as every other. It covers both versions of that idea — the continuous uniform over a real interval, and the discrete uniform over a run of equally likely integers — because the two are constantly confused and their variances are genuinely different.
Arb Digital publishes it alongside a full set of free distribution tools. The uniform distribution is where most people meet the shape of a probability calculation for the first time, and it is also the engine under almost every random number generator, so it repays being understood properly rather than skipped as trivial.
What This Uniform Distribution Calculator Does
Set the two bounds and an interval of interest, and the tool returns the probability that the variable falls in that interval, the density or per-value probability, and the three summary moments: mean, variance and standard deviation. It also reports both tails, so you have the cumulative probability below your interval and above it without a second calculation.
In continuous mode the density is a constant height, and the probability of any single exact value is zero — probability comes only from width. In discrete mode each listed integer carries a genuine, positive probability, and the endpoints are included. Switching between the two modes with the same numbers is the fastest way to see why the distinction matters.
How to Use It
- Choose continuous or discrete. Continuous suits measurements; discrete suits counted outcomes like a die roll or a random index.
- Enter the bounds a and b. In discrete mode both are included in the support, so a = 1 and b = 6 gives six outcomes, not five.
- Set the interval you want the probability for. If you only want a one-sided tail, put x₁ at a or x₂ at b.
- Read the density figure to check your support is what you intended — it is one over the width, or one over the count.
- Compare mean and variance between the two modes on the same bounds to see the discrete correction.
The Formulas
For the continuous uniform on [a, b], the density is flat and the cumulative function is a straight line, which the NIST/SEMATECH e-Handbook of Statistical Methods gives as f(x) = 1/(b − a) on the support. The moments follow, and Wolfram MathWorld states them on its uniform distribution page as a mean of ½(a + b) and a variance of (b − a)²/12.
Continuous: f(x) = 1/(b − a); F(x) = (x − a)/(b − a); mean = (a + b)/2; variance = (b − a)²/12.
Discrete over the n = b − a + 1 integers from a to b: P(X = k) = 1/n; mean = (a + b)/2; variance = (n² − 1)/12.
Two worked examples. Continuous on [0, 10] with the interval from 2 to 5: the width of interest is 3 and the total width is 10, so the probability is 0.3, the density is 0.1, the mean is 5, the variance is 100/12 = 8.3333 and the standard deviation is 2.8868. Discrete on the integers 1 to 6 — an ordinary die — with the interval from 2 to 5: four outcomes out of six gives 0.666667, each face carries 1/6, the mean is 3.5, and the variance is (36 − 1)/12 = 2.9167 for a standard deviation of 1.7078.
Why the Two Variances Differ
Notice that the continuous formula uses the width (b − a) and the discrete one uses the count n. Put the same bounds into both and you get different answers, and the difference is not a rounding artefact. Continuous on [1, 6] has width 5 and variance 25/12 = 2.0833. Discrete on {1, 2, 3, 4, 5, 6} has six outcomes and variance 35/12 = 2.9167.
The reason is that the discrete distribution puts all of its mass at the integers, including a full sixth of it at the extremes 1 and 6, while the continuous version spreads mass evenly and has almost none exactly at its endpoints. Concentrating mass at the far edges increases the spread. If you write n = b − a + 1 and expand, the discrete variance equals the continuous variance of an interval one unit wider, which is exactly the continuity correction that appears whenever a discrete variable is approximated by a continuous one.
Where the Uniform Distribution Is Actually Used
The most important use is as raw material. Nearly every random number generator produces continuous uniform values on [0, 1], and every other distribution is then manufactured from those by transformation. The standard route is inverse transform sampling: feed a uniform value into the inverse cumulative function of the distribution you want, and the output has that distribution. That is why the uniform is the one distribution a simulation library must implement correctly and the reason its quality is scrutinised so heavily.
Discrete uniforms model fair dice, fair coins, a shuffled card drawn at random, and random selection from a list. In statistics, p-values from a correctly specified test are uniform on [0, 1] under the null hypothesis, which is the basis for several goodness-of-fit checks. Rounding error is often modelled as continuous uniform over half a unit either way. And it serves as a maximum-entropy prior when you genuinely know nothing except the range, which is a much narrower claim than “no information” — a uniform prior on a parameter is not uniform after a change of variable.
How It Sits Against the Other Distributions
The uniform is the flat baseline the others depart from. The normal distribution calculator concentrates mass around a centre with unbounded tails; the uniform has no centre-seeking behaviour and hard boundaries. The exponential distribution calculator covers continuous waiting times with a memoryless property the uniform does not share. The binomial distribution calculator and the Poisson distribution calculator count events rather than spreading probability over a range.
One relationship is worth knowing precisely: the continuous uniform on [0, 1] is the Beta distribution with both shape parameters equal to one. Set both to 1 in the Beta distribution calculator and you get a flat density, which makes the uniform the natural starting point for any Bayesian problem about a proportion.
Reading the Three Parts of the Probability
Under the results the tool reports the probability below your interval and the probability above it, alongside the interval probability itself. Those three numbers always add to exactly one, and checking that they do is a genuine test rather than a decoration.
It catches two mistakes immediately. If you entered an interval that runs outside the support, the clipping shows up as a smaller interval probability than you expected, while the tails still complete to one — so you can see that the extra width you asked for contributed nothing. And if you entered bounds in the wrong order, the tool swaps them and says so in the line under the headline figure, rather than silently producing a negative width and a nonsensical probability.
The tails are also the quickest route to a one-sided answer. For the probability that the variable is below some value v, set x₁ to the lower bound and x₂ to v, and read the headline number; the “above” tail then gives you the complement without any subtraction. In continuous mode that complement is exact. In discrete mode, remember that the value v itself is included in the interval, so the complement starts at v plus one, which is exactly the off-by-one the next section warns about.
Edge Cases and Common Traps
If b equals a the distribution collapses to a single point, the density is undefined and the variance is zero. The tool reports that in writing rather than dividing by zero. If you enter the bounds the wrong way round, it swaps them rather than returning a negative probability, but check your input anyway.
Interval endpoints outside the support are clipped, so asking for the probability between −5 and 5 on the support [0, 10] correctly returns 0.5 rather than 1.0. In continuous mode, strict and non-strict inequalities give identical answers because a single point carries no probability, so P(X < x) and P(X ≤ x) are the same number. In discrete mode they are not: the endpoints are included here, so a request from 2 to 5 counts four outcomes, and if you meant three you should enter 3 to 5. That off-by-one is the single most common mistake with the discrete uniform, and it is worth checking against the dice probability calculator when the outcomes really are die faces.
Arb Digital builds free calculators that earn organic traffic because the definitions and the edge cases are right. Browse the library, or tell us what your audience keeps searching for.
Browse Free Tools Talk to Arb DigitalCommon Mistakes to Avoid
- Using the continuous variance formula for a discrete uniform. The discrete version uses the count of outcomes, not the width of the range.
- Forgetting that the discrete support includes both endpoints, so a to b holds b − a + 1 outcomes rather than b − a.
- Asking for the probability of an exact value in the continuous case, which is always zero no matter how narrow the range.
- Treating a uniform prior as expressing no information — it is flat only in the particular parameterisation you wrote it in.
- Leaving interval endpoints outside the support and reading the result as if the extra width contributed probability.
Related Free Tools From Arb Digital
Compare with the normal distribution calculator for the bell curve, the exponential distribution calculator for waiting times, the geometric distribution calculator for discrete waiting, the hypergeometric distribution calculator for sampling without replacement, and the inverse normal distribution calculator when you need a quantile rather than a probability. The free online tools hub lists every statistics tool we publish.
Frequently Asked Questions
A distribution in which every outcome in a fixed range is equally likely. The continuous version spreads probability evenly over a real interval; the discrete version gives the same probability to each of a run of integers.
The width of the range squared, divided by twelve. On the interval from 0 to 10 that is 100 divided by 12, which is about 8.3333.
Because it uses the number of outcomes rather than the width, giving n squared minus one, all over twelve. The discrete version places a full share of its mass exactly at the two extremes, which increases the spread.
Zero in the continuous case, since probability comes from width and a single point has none. In the discrete case it is one divided by the number of possible outcomes.
Yes. Switch the type selector to discrete and the tool treats the bounds as whole numbers, includes both endpoints in the support, and uses the discrete formulas for the probability and the variance.
The continuous uniform on 0 to 1 is exactly the Beta distribution with both shape parameters set to one, which is why it is the natural flat starting point in Bayesian problems about a proportion.
Because any other distribution can be built from uniform values by transformation, most simply by feeding them into the inverse cumulative function of the target distribution.