The Excel Rand function generates a random real number between 0 and 1.
The function takes no arguments and therefore, its syntax is:
Although the number generated is between 0 and 1, you can use the function to generate a random real number between any two supplied limits a and b, using the formula:
Examples of this are provided below.
In the following spreadsheet, the Excel Rand function is used to generate random numbers between different limits.
A | ||
---|---|---|
1 | =RAND( ) | - returns a random real number between 0 and 1 |
2 | =100 * RAND( ) | - returns a random number between 0 and 100 |
3 | =0.8 + (1.2 - 0.8) * RAND( ) | - returns a random number between 0.8 and 1.2 |
Note that the above formulas will return a different random number every time the spreadsheet recalculates. To force a recalculation at any time, press the F9 key.
For further details of the Excel Rand Function, see the Microsoft Office website.