RAND( ) function

Returns a random number that falls within a specified boundary.

Syntax

RAND(number)

Parameters

Name Type Description
number numeric

The numeric boundary for the random number.

If you specify a number with decimal places the random number generated has the same number of decimal places.

  • If you enter a positive number the random number returned is greater than or equal to zero, and less than the number you specified.

    Returns a number from 0 to 99:

    RAND(100)
  • If you enter a negative number the random number returned is less than zero, and greater than or equal to the number you specified.

    Returns a number from -1 to -100:

    RAND(-100)

Output

Numeric.

Examples

Basic examples

Returns 278.61:

RAND(1000.00)

Returns 3781:

RAND(10000)

Note

The return value will differ with each execution of the function.

Remarks

RAND( ) cannot replicate results

If you use the RAND( ) function consecutively with the same number value, it produces different results. Unlike the RANDOM command, the RAND( ) function has no seed value.

Duplicate random numbers possible

If you use RAND( ) to create a computed field that assigns a random number to every record in a table, it is possible that duplicate random numbers are generated. There is no guarantee that the random numbers will be unique.

The larger the number value in relation to the number of records in the table, the greater the chance that the generated numbers will be unique.

Random numbers dynamically update

A computed field with the RAND( ) function generates a new set of random numbers every time you perform actions such as quick sorting, applying a filter, rearranging columns, or scrolling through the view.

If you want to fix a set of random numbers, extract the data to a new table using the View or Fields option in the Extract dialog box.

ACL Scripting Guide 14.1