RAND
Returns a uniformly distributed pseudo-random number in the interval [0, 1).
RAND is volatile and recalculates whenever dependent formulas recalculate.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=RAND()
Remarks
- The result is always greater than or equal to
0and strictly less than1. - Because the function is volatile, repeated evaluations can return different values.
- The engine seeds randomness per evaluation context for reproducible execution flows.
Examples
Generate a random decimal in the ordinary interval.
Formula =RAND()
Expected result Decimal from 0 up to 1
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Scale the random decimal to a range from zero up to 100.
Formula =RAND()*100
Expected result Number
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Round down a draw in RAND's half-open unit interval to zero.
Formula =INT(RAND())
Expected result Number
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
RAND stays within bounds
Formula =LET(n, RAND(), AND(n>=0, n<1))
Expected result Logical value
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Derived integer bucket from RAND
Formula =LET(n, INT(RAND()*10), AND(n>=0, n<=9))
Expected result Logical value
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
Can RAND return the same value on every recalculation?
Not by default. RAND is volatile, so recalculation can produce a different sample each time.
If RAND is used twice in one formula, do both uses share one sample?
Only if you bind it once (for example with LET). Two separate RAND calls are two separate draws.
Why does RAND look deterministic in some engine runs?
Randomness is seeded per evaluation context, which keeps a run reproducible while still treating RAND as volatile across recalculations.