Uniform Distribution With Python

Uniform Distribution With Python

March 20, 2018

2 min read

Uniform Distribution With Python

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
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
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:)
easy as it seems:)

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

characteristics