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.



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.

Notation Used


XUnif(a,b)X \sim \text{Unif}(a, b) or XDU(a,b)X \sim \text{DU}(a, b)distribution of the random variable.

DiscreteUniform(a,b)\text{DiscreteUniform}(a, b)used to denote the distribution itself (not the random variable).

U(a,b)\text{U}(a, b)also used, though it can refer to either discrete or continuous; context is important.

P(X=k)=1ba+1,for k=a,a+1,,bP(X = k) = \frac{1}{b - a + 1}, \quad \text{for } k = a, a+1, \ldots, bprobability mass function (PMF), where:

aa — minimum value (lower bound)

bb — maximum value (upper bound)

kk — any integer in the range [a,b][a, b]

ba+1b - a + 1 — total number of possible outcomes

Key properties:

E[X]=a+b2E[X] = \frac{a + b}{2} — expected value (mean)

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

Special case:

DiscreteUniform(1,n)\text{DiscreteUniform}(1, n) — uniform distribution on {1,2,,n}\{1, 2, \ldots, n\}, often used for fair dice or simple random selection


See All Probability Symbols and Notations

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)
𝑛=ba+1𝑛=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)

,