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.
The spreadsheet below shows three examples, in which the Excel Rand function is used to generate random numbers between different limits.
|1||=RAND( )||- returns a random real number between 0 and 1|
|2||=RAND( ) * 100||- returns a random number between 0 and 100|
|3||=RAND( ) * (1.2 - 0.8) + 0.8||- 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.
Further details of the Excel Rand Function are provided on the Microsoft Office website.