- Get a random number from 0 to 1
- Syntax of the RAND function
- RAND function and volatility
- Generate new random numbers with update
- Changing the RAND refresh rate
- Entering the RAND function
- Random number generation from 1 to 10 or from 1 to 100
- Generate random integers from 1 to 10
Get a random number from 0 to 1
One way to generate random numbers in Google Sheets is with the RAND function. By itself, the function generates a limited range when it comes to generating random numbers, but by using RAND in formulas and combining it with other functions, the range of values can be easily expanded.
By specifying the top and bottom values of a range, you can force RAND to return random numbers in the specified range, such as 1 and 10 or 1 and 100.
The function output can also be reduced to integers by combining the function with the TRUNC function, which truncates or removes all decimal places from a number.
When a random value between 0 and 1 is generated in Google Sheets, the RAND function returns a random number between 0 and 1, inclusive. While the range of values generated by a function is usually described as 0 to 1, it is actually more accurate to say that the range is 0 to 0.9999999…
A formula that returns a random number between 1 and 10 returns a value between 0 and 9.99999…
Syntax of the RAND function
Function syntax refers to the layout of the function and includes the function name, parentheses, comma separators, and arguments.
Syntax for the RAND function:
Unlike the RANDBETWEEN function, which takes high and low level arguments, the RAND function takes no arguments.
RAND function and volatility
The RAND function is a volatile function that by default changes or recalculates every time a table changes, and these changes include actions such as adding new data.
In addition, any formula that directly or indirectly depends on the cell containing the volatile function is also recalculated every time there is a change in the worksheet.
Therefore, volatile functions should be used with caution in worksheets containing large amounts of data, as they can slow the program’s response time due to the frequency of recalculations.
Generate new random numbers with update
Since Google Sheets is a spreadsheet program, the RAND function can be forced to generate new random numbers by refreshing the screen using the web browser’s refresh button.
The second option is to press the key F5 on the keyboard, which also refreshes the current browser window.
Changing the RAND refresh rate
In Google Sheets, the frequency with which RAND and other volatile functions are recalculated can be changed from default when it changes on the:
To change and every minute.
In shifts and every hour.
Steps to change the refresh rate:
Select menu File to open a list of menu options.
Select Spreadsheet Settings in the list to open the dialog box Spreadsheet Settings †
In chapter recalculation dialog box, for example select the current option when it changes to view a full list of recalculation options.
Choose the right option recalculation in the list.
Press the button Save settings to save your changes and return to the sheet.
Entering the RAND function
Since the RAND function takes no arguments, it can be entered in any cell in a worksheet by typing:
Alternatively, the function can also be entered via the window auto aim in Google Sheets that appears when you type a function name in a cell. Steps:
Select a cell in the worksheet where you want to display the results of the function.
Enter equal sign † † ) and then the function name EDGE †
As you type, a window appears. automatic accompaniment with function names starting with the letter R.
When the name appears in the field EDGE select name to enter a function name and an open parenthesis in the selected cell.
A random number between 0 and 1 appears in the current cell.
To create another, press the key F5 on your keyboard or refresh your browser.
When you select the current cell, the entire function = edge() appears in the formula bar above the worksheet.
Random number generation from 1 to 10 or from 1 to 100
The general form of the equation used to generate a random number within a given range is:
= RAND() * (high – low) + low
Here, High and Low indicate the upper and lower limits of the desired number range.
To generate a random number between 1 and 10, enter the following formula into a worksheet cell:
= RAND() * (10 – 1) + 1
To generate a random number from 1 to 100, enter the following formula into a table cell:
= RAND() * (100 – 1) + 1
Generate random integers from 1 to 10
To return an integer — an integer with no decimal part — the general form of the equation is:
= TRUNC(RAND() * (high – low) + low)
To generate a random integer between 1 and 10, enter the following formula into a worksheet cell:
= TRUNC(RAND() * (10 – 1) + 1)