RAND
Return a random number from 0 up to (but not including) 1. A new value every time the sheet recalculates.
Syntax
RAND() Examples
Every example below was executed against VisiGrid engine 0.51.0 — not
transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.
| Formula | Result | Notes |
|---|---|---|
=AND(RAND()>=0,RAND()<1) | TRUE | Always at least 0 and always less than 1. |
=ISNUMBER(RAND()) | TRUE | |
=INT(RAND()*6)+1<=6 | TRUE | Scaled and floored, it rolls a die. |
Why the examples look strange
A page cannot print the value of RAND() — it would be wrong by the time you
read it. The examples check what is always true instead: that it lies in
[0, 1), and that scaling it gives the range you asked for. The build runs them
like any other example.
Any range
RAND()*(high-low)+low gives a random number between low and high. For
whole numbers, RANDBETWEEN says it directly.
It keeps changing
RAND is volatile: every edit anywhere in the sheet recalculates it. That is
the point for a simulation and a problem for a random sample you need to keep.
To freeze the values, copy the cells and paste them back as values.
Each cell gets its own number, so a column of =RAND() is a column of
independent draws — suitable for shuffling rows (sort by the random column) or
Monte Carlo trials. It is not a cryptographic generator; do not use it for
passwords or anything that must be unpredictable to an attacker.
Excel compatibility
Matches Excel. Takes no arguments; recalculates on every change to the sheet.