### Probability

#### Probability Basics

#### Probability Problems

#### Poker Probability

- Probability in stud poker
- Probability of straight
- Probability of flush
- Cards of equal rank
- Probability of no pair

#### Random Variables

#### Discrete Distributions

#### Continuous Distributions

### Probability: Table of Contents

#### Probability Basics

#### Probability Problems

#### Poker Probability

- Probability in stud poker
- Probability of straight
- Probability of flush
- Cards of equal rank
- Probability of no pair

#### Random Variables

#### Discrete Distributions

#### Continuous Distributions

# What is a Random Variable?

When the value of a
variable
is determined by a chance event, that variable is called a
**random variable**.

**Note:** Your browser does not support HTML5 video. If you view this web page on a different browser
(e.g., a recent version of Edge, Chrome, Firefox, or Opera), you can watch a video treatment of this lesson.

## Discrete vs. Continuous Random Variables

Random variables can be discrete or continuous.

**Discrete**. Within a range of numbers, discrete variables can take on only certain values. Suppose, for example, that we flip a coin and count the number of heads. The number of heads will be a value between zero and plus infinity. Within that range, though, the number of heads can be only certain values. For example, the number of heads can only be a whole number, not a fraction. Therefore, the number of heads is a discrete variable. And because the number of heads results from a random process - flipping a coin - it is a discrete random variable.**Continuous**. Continuous variables, in contrast, can take on any value within a range of values. For example, suppose we randomly select an individual from a population. Then, we measure the age of that person. In theory, his/her age can take on__any__value between zero and plus infinity, so age is a continuous variable. In this example, the age of the person selected is determined by a chance event; so, in this example, age is a continuous random variable.

## Discrete Variables: Finite vs. Infinite

Some references state that continuous variables can take on an infinite number of values, but discrete variables cannot. This is incorrect.

- In some cases, discrete variables can take on only a finite number of values. For example, the number of aces dealt in a poker hand can take on only five values: 0, 1, 2, 3, or 4.
- In other cases, however, discrete variables can take on an infinite number of values. For example, the number of coin flips that result in heads could be infinitely large.

When comparing discrete and continuous variables, it is more correct to say that continuous variables can always take on an infinite number of values; whereas some discrete variables can take on an infinite number of values, but others cannot.

## Test Your Understanding

**Problem 1**

Which of the following is a discrete random variable?

I. The average height of a randomly selected group of boys.

II. The annual number of sweepstakes winners from New York City.

III. The number of presidential elections in the 20th century.

(A) I only

(B) II only

(C) III only

(D) I and II

(E) II and III

**Solution**

The correct answer is B.

The annual number of sweepstakes winners results from a random process, but it can only be a whole number - not a fraction; so it is a discrete random variable. The average height of a randomly-selected group of boys could take on any value between the height of the smallest and tallest boys, so it is not a discrete variable. And the number of presidential elections in the 20th century does not result from a random process; so it is not a random variable.

# Cross Site Scripting

- How your website can be attacked.
- Best practices for XSS defense.