A random variable is a variable whose value depends on unknown events. We can summarize the unknown events as "state", and then the random variable is a function of the state.
Example:
Suppose we have three dice rolls ($D_{1}$,$D_{2}$,$D_{3}$). Then the state $S=(D_{1},D_{2},D_{3})$.
- One random variable $X$ is the number of 5s. This is:
$$ X=(D_{1}==5?)+(D_{2}==5?)+(D_{3}==5?)$$$$ X=(D_{1}=5?)+(D_{2}=5?)+(D_{3}=5?)$$
- Another random variable $Y$ is the sum of the dice rolls. This is:
$$ Y=D_{1}+D_{2}+D_{3} $$