Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
Types of Random Variables
Applications of Random Variables 
Key Takeaways
Last Updated: Mar 27, 2024

Introduction to Random Variables

Master Python: Predicting weather forecasts
Ashwin Goyal
Product Manager @


Probability is one of the easiest and favorite chapters for most students. Let’s take a simple example of tossing a coin, so the probability of getting head and tail is equal. Here the prediction variable that we are using to estimate the coin toss probability is called “Random Variable”.

Another popular example is rolling dice, and here all six sides have equal probability, so the estimator we are using to predict the possible outcomes is called Random Variables.




  • A Random Variable is a set of possible values from a random experiment.
  • The set of possible values is called the Sample Space.
  • A Random Variable is given a capital letter, such as X or Z.
  • Random Variables can be discrete or continuous.

Types of Random Variables


There are three types of random variables:

  • Discrete random variables
  • Continuous random variables
  • Mixed random variables


1.Discrete Random Variables:

Discrete random variables are random variables whose range is a countable set. A countable set can be either a finite set or a countably infinite set—for example, shoe size or weight of student.


2. Continuous Random Variables:

Continuous random variables, on the contrary, have a range in the forms of some interval, bounded or unbounded, of the real line. For example, Height, weight, temperature, and length are all examples of continuous data. Some continuous data will change over time; the weight of a baby in its first year or the temperature in a room throughout the day.

3. Mixed Random Variables:

Mixed random variables are a mixture of both continuous and discrete variables. These variables are more complicated than the other two. For example, the number of owl eggs in a nest, the number of times a college student changes major, shoe size, weight of a student.

Applications of Random Variables

  • Random variables are used in all engineering domains in Civil to calculate the beam length.
  • Random variables are used in Machine learning and neural networks.
  • In General Random Variables, are used for tossing a coin, rolling a dice.
  • Random variables are used for statistical analysis.
  • Random variables are used to check whether a circuit accepts data or not in electrical engineering.
  • Random variables are used for the emergency landing of planes.
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job


  1. What is meant by a random variable?
    A random variable is a rule that assigns a numerical value to each outcome in a sample space. It can be defined as a variable whose value is unknown or a function that gives numerical values to each experiment’s outcomes.
  2. What are random variables and their types?
    As we know, a random variable is a rule or function that assigns a numerical value to each outcome of the experiment in a sample space. There are two types of random variables, i.e., discrete and continuous random variables.
  3. How do you identify a random variable?
    Random variables are generally represented by capital letters, for example, X and Y.
  4. How do you know whether a random variable is continuous or discrete?
    A discrete variable is a variable whose value can be obtained by counting since it contains a possible number of values that we can count. In contrast, a continuous variable is a variable whose value is obtained by measuring.

Key Takeaways


In this blog, we have discussed:

  • Random variables and their examples
  • Types of Random variables
  • Applications of Random variables.

To learn more about Machine Learning, take a look at this course from CodingNinjas.


Next article
Bayesian Estimation
Live masterclass