← All how-to recipes

How to generate random numbers

✓ Verified in LibreOffice 25.8.7.3

Get random decimals, whole numbers in a range, or a whole grid of random values.

The formula

AppFormulaNotes
Excel=RANDBETWEEN(1,100)Whole numbers, both bounds inclusive. RAND() for 0-1 decimals; RANDARRAY(5,3) for a grid (365).
Google Sheets=RANDBETWEEN(1,100)Identical, including RAND and RANDARRAY.
LibreOffice Calc=RANDBETWEEN(1,100)Identical; RANDARRAY works in 25.8+ per our tests.

How it works

RANDBETWEEN gives whole numbers with both ends included; RAND gives decimals in [0,1) — scale with =RAND()*(max-min)+min. All of these are volatile: they re-roll on every edit or recalculation. To freeze a set of random values, copy the cells and Paste Special → Values only. (Our verification asserts the deterministic part — the bounds — since the values themselves change every run.)

Verified, not just documented

We ran =AND(RANDBETWEEN(1,100)>=1,RANDBETWEEN(1,100)<=100) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned True — exactly the expected result. Every formula here is confirmed by actually executing it.