User Tools

Site Tools


Action disabled: revisions
syntax:functions:randbetween

RandBetween(min_num, max_num)

Category: Number function


Description

This function generates a random whole number between the values min_num and max_num.


Arguments

ArgumentTypeDescription
min_numNumberThe minimum value of the returned number. Must be less than or equal to max_num.
max_numNumberThe maximum value of the returned number. Must be greater than or equal to min_num.


Return value type: Number (Integer)


Remarks

The min_num and max_num values are inclusive and can be the returned value.

The min_num value must be less than or equal to the max_num value, or an error is returned.

RandBetween returns integer values. If decimal values are used for min_num and/or max_num they are rounded up to the next integer and those values are used as the arguments. See Examples, below.


Examples

randbetween(1,3)  //Return values will be 1, 2, or 3.
randbetween(6,8)  //Return values will be 6, 7, or 8.
randbetween(1.1, 2.9)  //Return values will be 2 or 3.  (1.1 is rounded to 2.  2.9 is rounded to 3.)


See also

syntax/functions/randbetween.txt · Last modified: 2021/10/15 15:01 by craigt