# Random Variable, Distribution of the Discrete Random Variable With Python

March 17, 2018

Random variable — is a variable whose possible values are outcomes of a random experiment. For example the number of hits during the three shots(0, 1, 2, 3), or sum of the upward face after rolling 5 dice(5 … 25). This is examples of discrete random variables, variables with a fixed amount of possible values. Another type is continuous random variable — the variable that can take any value on the interval. For example, speed or mass of some random object.

``````import random

# tail
continuous_variable = random.random()
# 0.8902011603082036``````

Let’s take a closer look at discrete random variables. The discrete random variable has a number of possible values, each value has it is own probability. Since events are a mutually exclusive sum of all their probabilities equal to one.

A random variable will be completely described if we specify distribution — probability for each event. This way we can specify the Law of distribution of the discrete variable.

The law of distribution of a random variable is any relation that establishes a connection between the possible values of a random variable and the corresponding probabilities.