Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Discrete Uniform Distribution






Discrete Uniform Distribution: Equal-Chance Selection


The probabilistic experiment behind the discrete uniform distribution is one where a single outcome is selected from a finite set of possibilities, and every outcome is equally likely. There is no notion of success or failure, repetition, or accumulation — only a fair selection from a fixed range. Rolling a fair die or randomly choosing an integer from a known interval are typical examples. The defining feature of this experiment is the absence of bias: no outcome is favored over another.

Key Terms

Discrete Uniform Distributionequal probability across a finite set of values
Equally Likely Eventsthe underlying assumption of the discrete uniform
Expected ValueE[X]=(a+b)/2E[X] = (a+b)/2
VarianceVar(X)=(n21)/12\operatorname{Var}(X) = (n^2-1)/12

See All Probability Definitions


The Probabilistic Experiment Behind Discrete Uniform distribution


The discrete uniform distribution represents situations where a random experiment produces outcomes from a finite set, and every outcome is equally likely. There is no preference, weighting, or bias toward any value in the set. The defining feature is not randomness alone, but symmetry: the mechanism that generates outcomes treats all possibilities identically.

This distribution is appropriate when the experiment consists of one selection from a known finite collection and there is no additional structure such as repeated trials, success–failure outcomes, or dependence between selections. Once the range of possible values is fixed, the distribution is fully determined. There are no hidden dynamics — probability is spread evenly across the entire support.

Due to this simplicity, the discrete uniform distribution often serves as a baseline model. More complex discrete distributions can frequently be understood as deviations from uniformity caused by repetition, conditioning, or structural constraints.


Example:

Rolling a fair six-sided die once. The possible outcomes are 1,2,3,4,5,6{1,2,3,4,5,6}, and each value has the same probability. No outcome is favored over another by the mechanism of the experiment.

Discrete Uniform Notation

Notation

Discrete Uniform Notation

This is the one distribution whose name is genuinely ambiguous: U(a,b)U(a, b) names this family and its continuous namesake equally, and the two behave differently. The marks below are the disambiguators — the letters that resolve the name, the counted denominator, and the support that gives the game away. All catalogued among the probability symbols.
The declaration tilde and capital/lowercase split come from random variable notation and distribution notation; set braces from set notation; E[X]E[X] and Var(X)\operatorname{Var}(X) from expected value and variance notation.
XDU(a,b)X \sim \operatorname{DU}(a, b)
discrete uniform on the integers from a to b
The unambiguous spellings put the word in the name: DU\operatorname{DU}, DiscreteUniform\operatorname{DiscreteUniform}, sometimes Unif\operatorname{Unif} qualified in prose. Bare U(a,b)U(a, b) is the problem — it names this family and the continuous uniform with equal authority, and nothing inside the parentheses distinguishes them.
CasesTwo tells resolve it without asking the author: integer-looking bounds and a pmf mean discrete, real bounds with a density mean continuous; and the standard instance is written DU(1,n)\operatorname{DU}(1, n) — the fair die, the random draw from a numbered list.
Do not confuseIts continuous namesake, in both directions. The same U(3,7)U(3, 7) can mean five equally likely integers or an interval of infinitely many points — the first assigns each outcome probability 1/51/5, the second assigns every single point probability zero.
P(X=k)=1ba+1P(X{=}k) = \dfrac{1}{b - a + 1}
one over the number of values — bounds included
The denominator counts outcomes rather than measuring width, and the +1+1 is why: the integers from aa to bb inclusive number ba+1b - a + 1, not bab - a. That single term is the whole notational difference from the continuous uniform's 1/(ba)1/(b-a).
CasesOn the standard DU(1,n)\operatorname{DU}(1, n) the count collapses to the familiar 1/n1/n — the form most texts introduce first, and the reason the +1+1 often goes unnoticed until the lower bound stops being one.
Do not confuseThe interval width. Writing 1/(ba)1/(b-a) here is the fencepost error in probabilistic dress: on DU(1,6)\operatorname{DU}(1, 6) it hands each face 1/51/5, and the six probabilities sum to 1.21.2.
k=a, a+1, , bk = a,\ a{+}1,\ \ldots,\ b
the support is a list of integers, endpoints included
A stepped list, not an interval: the support is {a,a+1,,b}\{a, a+1, \ldots, b\} — spelled with set braces where the continuous family writes [a,b][a, b]. Braces against brackets is the fastest discrete/continuous tell on the page.
CasesIt joins the family's support-style census as its fifth member — beside the binomial's closed list, the Poisson's open ellipsis, the hypergeometric's clamps and the negative binomial's shifted list: here, a finite run with both ends named.
Do not confuseThe real interval [a,b][a, b]. The bracket form admits every real number between the bounds; this family admits only the integers among them, and the notation is the only place that distinction is recorded.

Parameters


aa : the smallest integer in the range

bb : the largest integer in the range

The uniform discrete distribution assigns equal probability to each integer between aa and bb, inclusive.

The values must be equally spaced and finite in number.

The parameters define the range — once aa and bb are set, every integer in that closed interval has probability 1ba+1\frac{1}{b - a + 1}.

This distribution is used when there's no reason to favor any outcome over another — every value is equally likely by design.

Probability Mass Function (PMF) and Support (Range)


The probability mass function (PMF) of a discrete uniform distribution is given by:

P(X=x)=1ba+1=1n,x{x1,x2,,xn}P(X = x) = \frac{1}{b - a + 1} = \frac{1}{n}, \quad x \in \{x_1, x_2, \dots, x_n\}


Where :
aa = lower bound (integer)
bb = upper bound (integer)
n=ba+1n=b−a+1 is total number of possible values

Intuition Behind the Formula


Uniformity: The term "uniform" implies that each outcome is equally likely. That is, no single value of the random variable is preferred over another. This is the key feature of a uniform distribution.

Support (Range of the Random Variable):
* The random variable XX can take on n=ba+1n = b - a + 1 distinct values: x1,x2,,xnx_1, x_2, \ldots, x_n.
* These values could be consecutive integers (like 1,2,3,,n1, 2, 3, \ldots, n) or any set of nn distinct values.
* The range or support is thus a finite, countable set.

Logic Behind the Formula:

The total probability must sum to 1:

i=1nP(X=xi)=1\sum_{i=1}^n P(X = x_i) = 1

Since all probabilities are equal:

n1n=(ba+1)1ba+1=1n \cdot \frac{1}{n} = (b - a + 1) \cdot \frac{1}{b - a + 1} = 1

This makes the individual probability of each outcome 1n=1ba+1\frac{1}{n} = \frac{1}{b - a + 1}.


Discrete Uniform Distribution

Equal probability for finite outcomes

Explanation

A discrete uniform distribution assigns equal probability to each value in a finite range. The probability mass function is P(X=k)=1ba+1P(X = k) = \frac{1}{b - a + 1} for akba \leq k \leq b. The expected value is E[X]=a+b2E[X] = \frac{a + b}{2}, and the variance is Var(X)=n2112\text{Var}(X) = \frac{n^2 - 1}{12}, where n=ba+1n = b - a + 1. Common examples include rolling a fair die, selecting a random card from a deck, or generating a random number from a finite range.


Cumulative Distribution Function (CDF)


The cumulative distribution function (CDF) of a discrete uniform distribution is given by:

FX(x)=P(Xx)={0,x<axa+1ba+1,axb1,x>bF_X(x) = P(X \leq x) = \begin{cases} 0, & x < a \\ \frac{\lfloor x \rfloor - a + 1}{b - a + 1}, & a \leq x \leq b \\ 1, & x > b \end{cases}


Where:
aa = lower bound (integer)
bb = upper bound (integer)
x\lfloor x \rfloor = floor function (largest integer less than or equal to xx)

Intuition Behind the Formula


Definition: The CDF gives the probability that the random variable XX takes on a value less than or equal to xx.

Three Regions:

1. Before the range (x<ax < a): No outcomes are possible below aa, so FX(x)=0F_X(x) = 0.

2. Within the range (axba \leq x \leq b): The CDF counts how many integer values from aa to x\lfloor x \rfloor are included, divided by the total number of outcomes (ba+1)(b - a + 1).
* Number of outcomes up to x\lfloor x \rfloor: xa+1\lfloor x \rfloor - a + 1
* Total outcomes: ba+1b - a + 1
* Therefore: FX(x)=xa+1ba+1F_X(x) = \frac{\lfloor x \rfloor - a + 1}{b - a + 1}

3. After the range (x>bx > b): All outcomes have occurred, so FX(x)=1F_X(x) = 1.

Step Function Behavior: Since XX only takes integer values, the CDF remains constant between integers and jumps by 1ba+1\frac{1}{b - a + 1} at each integer point.

Discrete Uniform Distribution CDF

CDF rises uniformly in equal steps

CDF Explanation

The cumulative distribution function (CDF) for the discrete uniform distribution is F(k)=ka+1ba+1F(k) = \frac{\lfloor k \rfloor - a + 1}{b - a + 1} for akba \leq k \leq b. The CDF increases in equal steps of 1n\frac{1}{n} where n=ba+1n = b - a + 1 is the number of possible values. Each step represents one additional outcome being included in the cumulative probability. The CDF reaches 1.0 at the maximum value bb and remains at 1.0 for all larger values.

Expected Value (Mean)


As explained in the general case for calculating expected value, the expected value of a discrete random variable is computed as a weighted sum where each possible value is multiplied by its probability:

E[X]=xxP(X=x)E[X] = \sum_{x} x \cdot P(X = x)


For the discrete uniform distribution, we apply this general formula to the specific probability mass function of this distribution.

Formula


E[X]=a+b2E[X] = \frac{a + b}{2}


Where:
aa = minimum value (lower bound)
bb = maximum value (upper bound)

Derivation and Intuition


Starting from the general definition and substituting the PMF P(X=x)=1ba+1P(X = x) = \frac{1}{b - a + 1} for each x{a,a+1,,b}x \in \{a, a+1, \ldots, b\}:

E[X]=x=abx1ba+1=1ba+1x=abxE[X] = \sum_{x=a}^{b} x \cdot \frac{1}{b - a + 1} = \frac{1}{b - a + 1} \sum_{x=a}^{b} x


The sum of integers from aa to bb is:

x=abx=(ba+1)(a+b)2\sum_{x=a}^{b} x = \frac{(b - a + 1)(a + b)}{2}


Substituting back:

E[X]=1ba+1(ba+1)(a+b)2=a+b2E[X] = \frac{1}{b - a + 1} \cdot \frac{(b - a + 1)(a + b)}{2} = \frac{a + b}{2}


The result E[X]=a+b2E[X] = \frac{a + b}{2} captures the symmetry of the uniform distribution: the expected value is simply the midpoint between the minimum and maximum values. Since all outcomes are equally likely, the average naturally falls at the center of the range.

Example


Consider rolling a fair six-sided die, where a=1a = 1 and b=6b = 6:

E[X]=1+62=3.5E[X] = \frac{1 + 6}{2} = 3.5


The expected value is 3.5, which is the arithmetic mean of all possible outcomes {1,2,3,4,5,6}\{1, 2, 3, 4, 5, 6\}. Note that the expected value need not be a possible outcome of the random variable.

Variance and Standard Deviation


The variance of a discrete random variable measures how spread out the values are around the expected value. It is computed as:

Var(X)=E[(Xμ)2]=x(xμ)2P(X=x)\mathrm{Var}(X) = \mathbb{E}[(X - \mu)^2] = \sum_{x} (x - \mu)^2 P(X = x)


Or using the shortcut formula:

Var(X)=E[X2]μ2\mathrm{Var}(X) = \mathbb{E}[X^2] - \mu^2


For the discrete uniform distribution, we apply this formula to derive the variance.

Formula


Var(X)=(ba+1)2112\mathrm{Var}(X) = \frac{(b - a + 1)^2 - 1}{12}


Where:
aa = minimum value (lower bound)
bb = maximum value (upper bound)

Derivation and Intuition


Starting with the shortcut formula, we need to calculate E[X2]\mathbb{E}[X^2].

We know from the expected value section that μ=a+b2\mu = \frac{a + b}{2}.

For E[X2]\mathbb{E}[X^2], using the PMF P(X=x)=1ba+1P(X = x) = \frac{1}{b - a + 1}:

E[X2]=x=abx21ba+1=1ba+1x=abx2\mathbb{E}[X^2] = \sum_{x=a}^{b} x^2 \cdot \frac{1}{b - a + 1} = \frac{1}{b - a + 1} \sum_{x=a}^{b} x^2


Using the formula for sum of squares: x=abx2=(ba+1)(2b2+2ab+2a2ab)6\sum_{x=a}^{b} x^2 = \frac{(b - a + 1)(2b^2 + 2ab + 2a^2 - a - b)}{6}

After algebraic manipulation:

Var(X)=E[X2]μ2=(ba+1)2112\mathrm{Var}(X) = \mathbb{E}[X^2] - \mu^2 = \frac{(b - a + 1)^2 - 1}{12}


The result shows that variance depends on the range width (ba+1)(b - a + 1) squared. A wider range of equally likely values produces higher variance. The formula is symmetric and increases quadratically with the spread between aa and bb.

Standard Deviation


σ=Var(X)=(ba+1)2112\sigma = \sqrt{\mathrm{Var}(X)} = \sqrt{\frac{(b - a + 1)^2 - 1}{12}}


Example


For a fair six-sided die where a=1a = 1 and b=6b = 6:

Var(X)=(61+1)2112=36112=35122.917\mathrm{Var}(X) = \frac{(6 - 1 + 1)^2 - 1}{12} = \frac{36 - 1}{12} = \frac{35}{12} \approx 2.917


σ=35121.708\sigma = \sqrt{\frac{35}{12}} \approx 1.708


The variance of approximately 2.917 indicates moderate spread around the mean of 3.5, with outcomes ranging from 1 to 6.

Mode and Median

Mode


The mode is the value of kk with the highest probability—the peak of the PMF.

For the discrete uniform distribution, all values have equal probability, so:

Every value in the range {a,a+1,a+2,,b}\{a, a+1, a+2, \ldots, b\} is a mode

The distribution is multimodal with ba+1b - a + 1 modes.

Intuition: Since the discrete uniform distribution assigns equal probability 1ba+1\frac{1}{b-a+1} to each value, no single outcome is more likely than any other. This reflects complete uncertainty within the specified range—all outcomes are equally probable.

Example:
For a=1a = 1, b=6b = 6 (rolling a fair die):

Modes = 1, 2, 3, 4, 5, 6 (all equally likely with probability 16\frac{1}{6})

Example:
For a=0a = 0, b=4b = 4:

Modes = 0, 1, 2, 3, 4 (all equally likely with probability 15\frac{1}{5})

Median


The median is the value mm such that P(Xm)0.5P(X \leq m) \geq 0.5 and P(Xm)0.5P(X \geq m) \geq 0.5.

For the discrete uniform distribution:

If ba+1b - a + 1 is odd:
Median = a+b2\frac{a + b}{2} (the middle value)

If ba+1b - a + 1 is even:
Any value between a+b12\frac{a + b - 1}{2} and a+b+12\frac{a + b + 1}{2} can be considered the median

Properties of the median:
• The median equals the expected value a+b2\frac{a + b}{2} when the range has an odd number of values
• For symmetric distributions, median = mode = mean (when appropriately defined)
• The median represents the center of the distribution

Example:
For a=1a = 1, b=6b = 6:
Mean = 1+62=3.5\frac{1 + 6}{2} = 3.5

Median = 3.5 (between 3 and 4)

Example:
For a=1a = 1, b=5b = 5:
Mean = 1+52=3\frac{1 + 5}{2} = 3

Median = 3 (the exact middle value)

Unlike continuous distributions where finding the median requires integration, for discrete distributions, the median is found by identifying the middle value(s) when outcomes are equally spaced and equally probable.

Applications and Examples


### Practical Example
Suppose you roll a fair six-sided die. The possible outcomes are {1,2,3,4,5,6}\{1, 2, 3, 4, 5, 6\}, and the probability of each face is:

P(X=x)=16=161+1,x=1,2,3,4,5,6P(X = x) = \frac{1}{6} = \frac{1}{6 - 1 + 1}, \quad x = 1, 2, 3, 4, 5, 6

Each face has an equal and independent chance of appearing.

Interactive Calculator


This interactive calculator computes probabilities for the discrete uniform distribution, where every value in a range has equal probability of occurring. Enter your minimum value (aa) and maximum value (bb) to model scenarios like fair dice rolls, random number selection, or lottery draws. The calculator shows you the equal probability for each value and lets you compute cumulative probabilities for any range within your specified bounds.

1. Select probability type: 'All values' for full distribution, or choose a specific query
2. Enter a (minimum value) - lowest possible value (integer)
3. Enter b (maximum value) - highest possible value (integer, must be greater than a)
4. For specific queries, enter x (target value) - the specific value you want to query
5. Click Calculate to see probabilities and distribution

Discrete Uniform Distribution Calculator

Enter the minimum (a) and maximum (b) values

Minimum value (integer)

Maximum value (integer)

,

Discrete Uniform at a Glance

The table below collects the full anatomy of the discrete uniform distribution into a single reference card — its parameters and support, the PMF and CDF, the mean and variance formulas, mode and median behavior, and the canonical fair-die example.
Aspect Formula / statement Note / example
Parameters a (min), b (max); n = b − a + 1 values a and b are integers with a ≤ b
Support {a, a + 1, ..., b} finite, equally spaced integers
PMF P(X = k) = 1 / (b − a + 1) = 1 / n for every k in the support every value carries the same probability mass
CDF F(x) = (⌊x⌋ − a + 1) / (b − a + 1) on [a, b]; 0 below a; 1 above b step function jumping by 1 / n at each integer
Expected value E[X] = (a + b) / 2 midpoint of the range; not always an attainable value
Variance Var(X) = ((b − a + 1)² − 1) / 12 = (n² − 1) / 12 grows quadratically with the range width
Mode and median every value is a mode; median = (a + b)/2 (interval when n is even) distribution is fully symmetric and flat
Canonical example fair six-sided die: a = 1, b = 6, n = 6 E[X] = 3.5, Var(X) = 35/12 ≈ 2.92, σ ≈ 1.71

Discrete Uniform Distribution FAQ

Why is the denominator b − a + 1 and not b − a?

+
Because it counts outcomes, not width. The integers from a to b inclusive number b − a + 1 — six faces from 1 to 6, not five. Writing 1/(b − a) is the fencepost error in probabilistic dress: on DU(1, 6) it hands each face 1/5 and the six probabilities sum to 1.2. The slip hides on DU(1, n), where the count collapses to 1/n.Read more →

Does U(a, b) mean the discrete or continuous uniform?

+
Bare U(a, b) names both with equal authority, and nothing in the parentheses distinguishes them. U(3, 7) can mean five equally likely integers, each with probability 1/5, or an interval of infinitely many points, each with probability 0. Two tells resolve it: a pmf and integer bounds mean discrete; a density and real bounds mean continuous.Read more →

What does the support line tell you about a distribution?

+
Often the family, before the formula does. Braces {a, a+1, …, b} mean a stepped integer run; brackets [a, b] mean a real interval. Among the discrete families the shapes differ too: a closed list for the binomial, an open ellipsis for the Poisson, computed clamps for the hypergeometric, a shifted list for the negative binomial.Read more →