The uniform random variable is one of the most simplest random variables to learn. It may not seem like much but it does contain some nice properties.

__What is a Uniform Random Variable?__

A uniform random variable is a random variable which takes on values from parameters to (inclusive). If the random variable is uniform then we denote it as .

(Note that we deal with the continuous uniform random variable and not the discrete case.)

The continuous probability distribution function (pdf) of a uniform random variable is:

The image below shows the (theoretical) continuous probability distribution for the uniform random variable.

__The Cumulative Distribution Function (CDF)__

The Cumulative Distribution Function or the CDF is the probability that a real-valued random variable with a given probability distribution is less than or equal to a quantity . It is often denoted by .

The CDF of a uniform random variable is . for .

*Proof*

**Generating/Simulating/Sampling Uniform Random Variables**

Generating a uniform random variable from 0 to 1 (not including 1) is quite simple in Microsoft Excel. The function is =RAND().

To generate or simulate a uniform random variable in the free statistical programming language R, we use the runif function as follows:

__Examples__

In these two examples, I am simulating/generating standard uniform random variables from 0 to 1 in the statistical program R.

*Case One (Running 1000 simulation trials):*

1 2 |
data = runif(1000,min = 0, max =1) hist(data) |

*Case Two (Running 1 Million Simulation Trials):*

1 2 |
data = runif(10^{6},min = 0, max =1) hist(data) |

Comparing the two images above, increasing the number of trials makes our sample probability distribution become closer to the rectangle shape as in the first image above.