In Google Sheets, there are three functions that you can use to generate a random number or multiple random numbers. These functions are:
- RAND
- RANBETWEEN
- RANDARRAY
In the tutorial, we will learn to use these functions one by one.
RAND
With RAND, you can generate a random number between 0 and 1 in a cell. This function doesn’t have any argument to define; you need to enter the function with the parentheses and then hit enter to get the result.
=Rand()
You can see in the above snapshot; we have a random number between 0 and 1. And in the same way, you can enter it in an entire range. And this is how it looks when you decrease the decimals to 2.
RANDBETWEEN
With the RANBETWEEN, you can specify starting and ending numbers to get the random numbers. It is a range of random numbers.
In the RANDBETWEEN, you have two arguments to define the low and high numbers. In the below example, we have 100 as the lowest number and 200 as the highest number.
=RANDBETWEEN(100,200)
In returns is has returned 193 in the result. And in the same way, you can drag the formula downwards to the have in a range of cells.
RANDARRAY
RANDARRAY works in the same way the RAND function works. But it can get the random numbers (between 0 and 1) in an array in a single go.
In the below example, we have used 5 rows and 5 columns to get the random number and that’s how it has returned the number in the range five rows and five columns in the range A1:E5
All the functions we have discussed here are VOLATILE functions that change the value (update itself) when you re-calculate anything in the sheet.
=RANDARRAY(5,5)