# Documentation/Calc Functions/RANDBETWEEN

Other languages:

RANDBETWEEN

Mathematical

## Summary:

Returns an integer random number in a specified range.

## Syntax:

RANDBETWEEN(Bottom; Top)

## Returns:

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.

## Arguments:

Bottom is a integer value or a reference to the cell containing that value which is the lower bound for giving the range to get random number.

Top is a integer value or a reference to the cell containing that value which is the bound bound for giving the range to get random number.

• 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, i.e. they truncated to integers. 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).

## Examples:

Formula Description Returns
=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

RAND

## ODF standard:

Section 6.16.51, part2

RANDBETWEEN