# TI-82: Generating Random Numbers

You can generate random numbers on the TI-82 calculator using the following sequence. N is the number of different values which could be and S is the minimum number.

```     int (N*rand+S)
```

INT is found under the MATH menu (math num 4). RAND is also found under the MATH menu (math prb 1).

Simulate the rolling of a die (1-6): int (6*rand+1)

Simulate the flipping of a coin (0-1): int (2*rand)

This works because the rand function returns a random number between 0 and 1 (including 0 but not including 1). When it is multiplied by N, it becomes between 0 and N, and then S is added, so it becomes between S and S+N.

If you have two values (A and B) that you need random numbers between, then you can generate them using the following formulas.

```     N=B-A+1
int (N*rand+A)
```

Notice it is B-A+1 not B-A. Everyone agrees there are 10 numbers between 1 and 10 (inclusive). But, if you take 10-1, you get 9, not 10. Also, in the formula above, replace the N by the actual number of different values.

Since the calculator remembers the last formula put in, and evaluates it when you hit enter, to generate more random numbers, just hit enter again. Each time you hit enter, you will get another random number.