What is a random variable?
A random variable or stochastic variable maps the outcome of a random experiment to a real value. Simply put, random variables represent variability probabilistically. That's why they take different values, depending on the outcomes of probabilistic experiments or random distributions in a sample space.
Capital italicized Roman letters such as 'X' or 'Y' generally represent random variable values that can be discrete (specific values) or continuous (values within a continuous range).
In probability and statistics, random variables quantify random occurrence outcomes. Risk analysts use statistical analysis software to depict the probability of an adverse event occurring with random variables. Econometric and regression analysis show relationships among random variables.
Importance of random variables
Random variables make it easier for statisticians to analyze real-world problems based on data sampling. These variables create probability distributions to facilitate experimentation, data generation, and observations.
Types of random variables
Random variables in statistics are likely to return any possible values because of probability distributions. Random variables can be of two types based on the number of values.
1. Discrete random variables take on a countable, sometimes infinite, number of distinct values. For example, when thrown, a dice returns a finite number of outcomes (1, 2, 3, 4, 5, and 6). Each dice outcome in this purely random event has an equal probability of 1/6.
Types of discrete random variables:
- Binomial random variables show the number of successes in a binomial experiment that has a fixed number of independent trials with two outcomes.
- Geometric random variables indicate the number of experiments run before achieving success. These variables are used for experiments with two possible outcomes, i.e., success and failure.
- Bernoulli random variables are the simplest random variables and represent success with 1 and failure with 0.
- Poisson random variables reveal how many times an independent event occurs at a constant rate within a given period.
2. Continuous random variables represent an uncountable number of values within a specified range or interval. For example, a continuous random variable is best for representing the average rainfall in a city or the average height of a random group of people. In both cases, the resulting outcome can be a continuous figure, hence continuous random variables.
Types of continuous random variables:
- Exponential random variables model an exponential distribution to depict the time elapsed between two events.
- Normal random variables follow a normal distribution with mean μ=0 and standard deviation σ=1.
Random variable vs. probability distribution
A random variable takes a random value based on the outcome of a random event.
A probability distribution is a statistical function showing the chances of obtaining all possible values a random variable can take. Simply put, a probability distribution represents the chances of multiple outcomes in a table or equation.
A table showing the average monthly rainfall in a city for a given year is an example of a probability distribution. Those monthly values can be continuous or discrete variables, depending on whether they take continuous or specific values.

Sudipto Paul
Sudipto Paul is a Sr. Content Marketing Specialist at G2. With over five years of experience in SaaS content marketing, he creates helpful content that sparks conversations and drives actions. At G2, he writes in-depth IT infrastructure articles on topics like application server, data center management, hyperconverged infrastructure, and vector database. Sudipto received his MBA from Liverpool John Moores University. Connect with him on LinkedIn.