Explore

The discrete uniform distribution

Every whole number from a to b is equally likely, so each has probability 1/(b − a + 1). Move the ends a and b, then ask a question: the bars it counts are shaded.

Parameters

a = 1

a (lowest value)

b = 6

b (highest value)

Ask a question

k = 5

k (threshold)

Compare with

P(X ≥ 5) = 0.3333

P(X ≥ 5) = 1 − F(4) = 1 − 0.6667 = 0.3333

X is a count, so the boundary matters: P(X < k) = F(k − 1) and P(X ≥ k) = 1 − F(k − 1), and ≤ gives a different answer from <.

Summary

Measure U{1, …, 6}
mean 3.5000
variance 2.9167
standard deviation 1.7078
skewness 0.0000

The same in code

Python (scipy.stats)
randint.sf(4, 1, 7)
Excel
=1-(4-1+1)/6
Excel has no discrete uniform function, so the formula is the arithmetic itself. In scipy, randint's upper end is exclusive: randint(a, b + 1) runs from a to b.

Formulas

Try this

0 of 4 done
  1. Fewer than, or at most?

    Switch the question between P(X < 96) and P(X ≤ 96) for the bookseller.

    Look for: The answers differ by one bar, P(X = 96) = 1/11. For a count the boundary value itself carries probability, so read "fewer than" and "at most" carefully.

  2. Widen the range

    Keep a at 1 and move b from 6 up to 20.

    Look for: Every bar gets shorter: the same total probability of 1 is shared among more values. The mean moves to (a + b)/2 and the ±1σ band widens.

  3. No skew

    Move a and b anywhere and watch the skewness.

    Look for: It stays at 0. The bars are symmetric about the mean, which sits halfway between a and b even when that is not a possible value, as 3.5 is for a die.

  4. Bars and a flat density

    Turn on the comparison with the continuous uniform.

    Look for: The flat density lies exactly on top of the bars. Spread each bar over a width of 1 and the discrete uniform becomes the continuous one from a − ½ to b + ½.

An unhandled error has occurred. Reload ๐Ÿ—™

Reconnecting…

Your connection to Introduction to Probability Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.