Generates a random normally-distributed number.

randNorm(*mean*,*std-dev*)

**Menu Location**

- Press 2nd MATH to enter the MATH popup menu.
- Press 7 to enter the Probability submenu.
- Press 5 to select randNorm(.

This command works on all calculators.

1 byte

The randNorm() command generates a random number that is normally distributed, with a given mean (first parameter) and standard deviation (second parameter). This means that on average, randNorm(x,y) will give a result of about x; it's 95% certain to be within 2*y of x.

See rand() and RandSeed for more details on the random number generator.

# Formula

The formula for randNorm() is different from the one used by the TI-83 series. To generate normally-distributed values from the output of rand(), the calculator uses the polar form of the Box-Muller transform. The algorithm goes as follows:

First, generate two uniformly distributed numbers *u* and *v* in [-1,1]. Keep doing this until the result lies in the unit circle; the point (0,0), though it's unlikely to occur, is discarded as well. Let *s* equal *u*^{2}+*v*^{2}.

Usually, Box-Muller is used to produce two normally-distributed random numbers, by the formula below. The TI only uses the second of the results:

(1)The result is distributed according to the standard normal distribution: that is, with mean 0 and standard deviation 1. It's easy to get any other normal distribution by scaling: multiplying by the standard deviation, and then adding the mean.

In TI-Basic, the code for randNorm(μ,σ) would be:

```
:Loop
: 2*rand()-1→u
: 2*rand()-1→v
: u^2+v^2→s
: If 0<s and s<1
: Return μ+σ*v*√(-2*ln(s)/s)
:EndLoop
```