Probability theory: Uniform distribution

This is part of the course “Probability Theory and Statistics for Programmers”.

Probability Theory For Programmers

The uniform distribution is one of the simplest distributions. It exists for both discrete and continuous variable. For discrete one it is a distribution whereby a finite number of values are equally likely to be observed. An example of the discrete uniform distribution is throwing a fair dice. The possible values are 1, …, 6, and each time the dice is thrown the probability of a given score is 1/6.

probability for a discrete random variable with uniform distribution

If all possible values of a continuous random variable inside some interval and all of them have the same probability. Then this variable has the uniform distribution. Since all values of such random variable inside an interval and have the same probabilities we have the probability density function equal to:

the probability density function for a continuous random variable with uniform distribution

Where a is the start of interval and b is the end.

Let’s take an example. The bus arrives at station one time in 20 minutes. Some passenger came to the station at random time, what the probability that passenger gets on the bus in 5 minutes interval? This time I will show this without code.

easy as it seems:)

Let’s take a look at the characteristics of the Uniform distribution. The mean and the variance:

Next part ->

Reach the next level of focus and productivity with





Indie hacker behind More at

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Make Money Online Answering Math Questions

Numerological Counterparts by Multiplication

Achieving Mathematical Maturity

The Monty Hall problem, but different

Research Design + Statistics Tests

N-Queen Backtracking Problem with Time Complexity

To Stock or Not to Stock

Commodity pricing, how do you actually do it?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Radzion Chachura

Radzion Chachura

Indie hacker behind More at

More from Medium

Improving March Madness Bracket Performance Through Machine Learning

Opening the Bayesian inference/Markov chain Monte Carlo (MCMC) pandora’s box: Part — I

What Could Go Wrong: Linear Regression

Probability Theory