Returns an integer random number in a specified range.
Returns an integer random number between integers Bottom and Top (both inclusive). This function produces a new random number each time Calc recalculates. To force Calc to recalculate manually press F9.
Bottom is an integer value or a reference to the cell containing that value which is the lower bound.
Top is an integer value or a reference to the cell containing that value which is the upper bound.
- If Bottom is greater than Top, the function returns an error value.
- If both Bottom and Top are equal then the function returns that same value.
- If arguments are not integer, then they are rounded to nearest integer either above or below. For eg. 5.4 is rounded to 5, 5.6 to 6 and 5.5 to 6.
To generate random numbers which never recalculate:
- copy cells containing this function, and use Edit > Paste Special (with Paste All and Formulas not marked and Numbers marked).
- Use the Fill Cell command with random numbers (Sheet - Fill Cells - Fill Random Numbers). It offers options to set a Minimum and Maximum limit in which the random number is generated.
Use the RANDBETWEEN.NV() function for non-volatile random numbers.
|=RANDBETWEEN(20;30)||a random integer between 20 and 30||23|
|=RANDBETWEEN(20.4;30.8)||a random integer between 20 and 31, rounding to closest integers||27|
Related LibreOffice functions:
Equivalent Excel functions: