Math calculator

Uniform Distribution Calculator

Flat probability — in two forms that are not interchangeable.

Every outcome equally likely — over an interval, or over a list

P(X ≤ 7.0000)

0.700000

70.0000% — a flat density of 0.100000 per unit

-1.5011.5

Mean

5.000000

Variance

8.333333

Standard deviation

2.886751

Density

0.100000

The range rule of thumb, checked against the exact answer. “SD ≈ range ÷ 4” gives 2.500000 here. The exact standard deviation is 2.886751 — the rule is 13.4% too low. For a uniform the correct divisor is √12 ≈ 3.464, not 4; the 4 comes from the normal distribution, where a sample of a few dozen typically spans about four standard deviations. Applying it to a flat distribution is applying the wrong shape’s constant.

What this tool shows

Two distributions share this name. The continuous uniform spreads probability over an interval, so P(X = 7) is exactly zero. The discrete one spreads it over a list, so P(X = 7) is 1/n. Their variances differ too, for identical endpoints. This calculator asks which you mean before anything else.

  • Continuous uniform on an interval [a, b]
  • Discrete uniform over the whole numbers a…b
  • At most, at least, between, and exactly
  • Mean, variance and standard deviation for each
  • Why ≤ and < give the same answer in one and not the other
  • The range rule of thumb tested against the exact SD
Both forms P(X = x) explained Exact moments Rule of thumb tested

On 1…10 the discrete variance is 8.25; the continuous is 6.75.

Updated 8 September 2026 · Works in any browser, no installation

Uniform means every outcome is equally likely. Over an interval that makes the density flat — a rectangle — and probability becomes a length ratio: the width you asked about divided by the total width. Over a list it makes every item 1/n.

At a glance

Formula shown
Continuous: f(x) = 1/(b − a) on [a, b], P(c ≤ X ≤ d) = (d − c)/(b − a), mean (a + b)/2, variance (b − a)²/12. Discrete over n values: P(X = x) = 1/n, variance (n² − 1)/12. Note the two variance formulas are different, not two ways of writing one.
Scenario support
Random number generators; rounding error; a bus arriving at an unknown time within a known window; a fair die or a fair lottery draw; a maximum-ignorance prior over a bounded range; simulation inputs before any data arrives.
Educational estimate
Planning support from the values you enter — not professional advice.

Continuous or discrete — the answer changes

These are two different distributions with one name, and choosing wrongly changes the number you get.

The continuous uniform lives on an interval. Any real value in [a, b] is possible, and probability is proportional to width. The density is 1/(b − a) everywhere inside and zero outside.

The discrete uniform lives on a list — the faces of a die, the whole numbers 1 to 10, the names in a hat. Each of the n items carries probability 1/n.

The first consequence is P(X = 7). For the continuous form it is exactly zero, and that is not a rounding artefact: an interval contains infinitely many points, so no single one can carry a positive share without the total exceeding 1. For the discrete form over 1…10 the same question is 0.1.

The second consequence follows from the first. Because the boundary carries no probability, P(X ≤ x) and P(X < x) are identical for the continuous uniform. For the discrete one they differ by exactly 1/n whenever x is one of the values. Strict versus non-strict inequality is a genuine distinction in one case and no distinction at all in the other.

The third is the variance, and it is the one that gets missed. Over 1…10 the discrete variance is (10² − 1)/12 = 8.25. The continuous uniform on the interval [1, 10] has variance (10 − 1)²/12 = 6.75. Same endpoints, and the discrete answer is 22% larger, because its probability sits at the extremes rather than being spread evenly toward the middle.

The range rule of thumb is a normal-distribution constant

“Standard deviation is about the range divided by four” is taught as a universal sanity check. It is not universal — it is a property of the normal distribution, and it is measurably wrong here.

For a uniform, the exact standard deviation is the range divided by √12 ≈ 3.464, which is 0.2887 of the range. The rule of thumb gives 0.25 of the range. So on any uniform, the rule runs 13.4% too low, regardless of the endpoints — the tool prints both numbers side by side so you can see the gap rather than take it on faith.

The 4 comes from somewhere real: draw a few dozen values from a normal distribution and the observed range tends to span roughly four standard deviations. That is a fact about the normal’s tails, and a uniform has none — it stops dead at its endpoints. Carrying the constant across is carrying the wrong shape’s assumption.

The rule also degrades with sample size in a way its usual phrasing hides: the expected range grows as you take more observations, because extremes get more chances to appear. At n = 10 the divisor is closer to 3; at n = 100 it is closer to 5. A single constant cannot be right for both.

Use the rule for what it is — a rough order-of-magnitude check on a roughly normal sample of moderate size — and compute the actual standard deviation when the number matters.

Why it is the “I know nothing else” distribution

There is a precise sense in which the uniform is the distribution of maximum ignorance, and it is worth stating because it justifies a lot of practical modelling.

Among all distributions on a bounded interval, the uniform has the highest entropy. Entropy measures how much the distribution refuses to commit. If the only thing you know is that a quantity lies between a and b, any other choice smuggles in an assumption — a peak somewhere, a skew in one direction — that your information does not support.

That is why the uniform is the default prior in a Bayesian analysis with no prior information, the default input distribution in a simulation before data arrives, and the default assumption for rounding error: a value rounded to the nearest unit is uniformly distributed within ±half a unit of the true one, and that gives rounding error a standard deviation of 0.2887 units by the formula above.

The caution is that ignorance is not scale-free. Uniform on a length is not uniform on the corresponding area, because squaring is not linear. Saying “I know nothing about the side of this square, so uniform” and “I know nothing about its area, so uniform” give different and incompatible answers. A flat prior is a real assumption about which scale your ignorance is flat on.

For a bounded quantity where you do have some information, the beta distribution generalises this: Beta(1, 1) is exactly the uniform on [0, 1], and other parameter values encode what you have learned.

Random numbers, and why everything starts here

Every random number generator you have used produces a uniform on [0, 1) and nothing else. Every other distribution is manufactured from it.

The mechanism is inverse transform sampling: if U is uniform on [0, 1) and F is any distribution’s cumulative function, then F⁻¹(U) has that distribution. Feed uniform randomness into the inverse CDF and normal, exponential or lognormal values come out. It works because F maps every distribution onto [0, 1] by construction — a CDF is the uniform scale.

The same fact runs backwards and is more useful diagnostically. If your model is right, the probability integral transform of your data is uniform. Push each observation through the fitted CDF; the results should look flat. A histogram that piles up at the ends says the model’s tails are too thin; one that piles up in the middle says they are too fat. This is what a P-P plot is testing, and it is a sharper check than most formal goodness-of-fit tests because it shows you where the model fails.

One practical caveat: a computer’s uniform is not uniform, it is a deterministic sequence engineered to pass tests for uniformity. That is fine for simulation and wrong for cryptography, which is why the two use different generators.

When data really is uniform — and when it only looks flat

Genuine uniformity is rarer than flat-looking histograms, and the difference matters.

It genuinely fits when a mechanism enforces it: a fair die or lottery draw, arrival time within a fixed timetable gap, rounding error, the phase of a rotating object observed at a random instant, and the output of a random number generator.

It only looks flat when a small sample has not had enough observations to reveal its shape. With 20 points, almost anything looks roughly level. The test is not the histogram — it is whether you can name the mechanism that would force equal probability.

Estimating the bounds is genuinely awkward, and this is where a uniform surprises people. The obvious estimate of b is the largest value you observed — and it is always too small, because the true maximum is almost certainly above every value in any finite sample. The standard correction multiplies the sample maximum by (n + 1)/n. This is the German tank problem, and it worked: Allied statisticians estimated German tank production from the serial numbers of captured vehicles far more accurately than intelligence estimates did.

The uniform is also the wrong default for anything unbounded. It requires hard limits on both sides. If your quantity has no natural ceiling, the exponential or normal is the honest starting point instead.

Sources and methodology

References for both forms and the sampling result.

Method. Continuous probabilities are length ratios computed directly from the endpoints, so they are exact rather than approximated. The discrete form counts the whole numbers in the requested range and divides by the total count, which is why it and the continuous form can disagree on identical inputs — correctly. The suite asserts the two variance formulas against each other on shared endpoints (8.25 discrete versus 6.75 continuous on 1…10), that the continuous P(X = x) is exactly zero while P(X ≤ x) equals P(X < x), and that the range rule of thumb sits 13.4% below the exact standard deviation at every interval width. That engine is verified on every change against 219 assertions. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Beta DistributionTakes raw successes and failures and runs the conjugate update, so 5 out of 5 returns 6/7 rather than the 100% a plain proportion claims — with a credible interval that stays honest at zero.
Normal DistributionProbabilities under a normal curve in all four directions with the region shaded — and the empirical rule given exactly, because two standard deviations is 95.45% and the 95% everyone quotes sits at 1.96σ.
Exponential DistributionTime-until-event probabilities from a rate or a mean, always showing both — with a panel proving elapsed time changes nothing, which is a constant hazard rate and false for anything that wears out.
Standard DeviationSample and population standard deviation, plus variance, mean, median, quartiles, z-scores, outliers, and confidence intervals.
ProbabilityTwo events, repeated trials and Bayes, with the three usual errors handled — the dropped overlap in P(A or B), n×p instead of the complement, and the base rate that makes a 99% test 17% right.
VarianceSample and population variance from your data, with a live simulation that shows exactly how much the wrong divisor costs — 20% low at n = 5, closing as the sample grows.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool. The uniform distribution requires hard bounds on both sides and a mechanism that genuinely equalises the outcomes; a flat-looking histogram from a small sample is not evidence of uniformity.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 8 September 2026

  1. Published a uniform calculator that treats the continuous and discrete forms as the separate distributions they are: P(X = x) is exactly zero for one and 1/n for the other, and on the endpoints 1 to 10 their variances are 6.75 and 8.25.
  2. Measures the 'standard deviation is about the range over four' rule against the exact answer. For a uniform the correct divisor is the square root of 12, so the rule runs 13.40% low at every interval width — the tool prints both numbers rather than asserting it.
  3. Explains why the continuous form makes the strict and non-strict inequalities identical, which is a real distinction in the discrete form and no distinction at all in the continuous one.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.