RAND( ) function

Returns a random number between zero and the value of a numeric expression.





Numeric. The maximum value of the random number.




RAND( ) returns a random number greater than or equal to 0 and less than the value in the number parameter. For example, the output of RAND(100) is a number from 0 to 99. It is possible for duplicate random numbers to be generated if the value in the number parameter is less than the number of records in the table. For example, if a table has 2000 records and you create a computed field using the expression RAND(1000), there will be duplicates in the output. The number parameter can be positive or negative and can include decimals. The random number generated has the same number of decimal places as the number parameter.


Because expressions are evaluated whenever the table layout or the view changes, the RAND( ) function generates a new random number every time you perform actions such as applying a filter, rearranging columns, or simply scrolling through the view. To ensure that a random number does not change once it has been generated, extract the data to a new table using the View or Fields option in the Extract dialog box.

You can use this function to generate a random number for use in ACL or in another application.


If you use the RAND( ) function consecutively with the same value, it produces different results. The sequence is not reseeded before ACL generates the second result. To reseed the sequence, use the RANDOM command.


Example Return value





(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback