How to Generate Random Numbers in Google Sheets (RANDBETWEEN and RAND)

By Gerard Fernandez · Updated · 2 min read

Random numbers are useful for test data, raffles, picking a winner or shuffling a list. Google Sheets has two functions for them.

RANDBETWEEN: random whole numbers

=RANDBETWEEN(1, 6)

Returns a whole number between the two values, including both ends, like rolling a die.

RAND: random decimals between 0 and 1

=RAND()

Returns a decimal of 0 or more and less than 1. Multiply it to get other ranges: =RAND()*100 gives a decimal between 0 and 100.

They change all the time

Both functions recalculate every time the sheet changes: typing anything in any cell gives new numbers. We tested it by typing a single letter in an unrelated cell:

Google Sheets: RANDBETWEEN(1, 6) shows 3, RAND() shows 0.7659002466 and ROUND(RAND()*50, 2) shows 26.15
Real test, before: a die roll of 3, a decimal and a price of 26.15.
The same formulas after typing y in D5: the die roll is now 4, the decimal 0.6032533246 and the price 20.47
Real test, after typing "y" in D5: all three values changed.

To keep a set of results, select them, copy, and use Edit → Paste special → Values only.

Useful recipes

You want…Formula
A random item from a list in A2:A20=INDEX(A2:A20, RANDBETWEEN(1, ROWS(A2:A20)))
A random date in 2026=RANDBETWEEN(DATE(2026,1,1), DATE(2026,12,31)) (format as date)
A price with two decimals=ROUND(RAND()*50, 2)
Several random numbers at once=RANDARRAY(5, 1)

Shuffle a list

Select the range and go to Data → Randomize range (Randomise range in UK English). The rows are shuffled once and stay in their new order. To shuffle with a formula instead, use =SORT(A2:A20, RANDARRAY(ROWS(A2:A20)), TRUE).

Frequently asked questions

Can RANDBETWEEN give the same number twice?

Yes, each cell is independent. For unique numbers, shuffle a list of 1 to N instead, for example =SORT(SEQUENCE(10), RANDARRAY(10), TRUE). In our test, the 5-number version gave 4, 1, 3, 2, 5, and a different order after the next edit, with no repeats either time.

Why does the number change when I open the file?

Random functions recalculate on every change and on opening. Paste the results as values to freeze them.