Random Numbers in MATLAB

When you create random numbers using software, the results are not random in a strict, mathematical sense. However, software applications, such as MATLAB®, use algorithms that make your results appear to be random and independent. The results also pass various statistical tests of randomness and independence. These apparently random and independent numbers are often described as pseudorandom and pseudoindependent. You can use these numbers as if they are truly random and independent. One benefit of using pseudorandom, pseudoindependent numbers is that you can repeat a random number calculation at any time. This approach can be useful in testing or diagnostic situations.

Although repeatability can be useful, it is possible to repeat your results accidentally when you really want different results. There are several ways to avoid this problem. The documentation contains several examples that show how to ensure that your results are different when that is your intention.


You can assume any reference to random numbers in the MATLAB documentation is actually referring to pseudorandom numbers, unless otherwise stated.

Related Topics