RANDOM command

Used to generate a list of random numbers.

Syntax

RANDOM NUMBER n <SEED seed_value> MINIMUM min MAXIMUM max <UNIQUE>
<COLUMNS n> <SORTED> <TO SCREEN|filename> <APPEND>

Parameters

NUMBER n

Specifies the number of random numbers to be generated.

SEED seed_value

Specifies the starting point for the random number generator. If a RANDOM command is duplicated with the same seed value, the random number sequence is reproduced exactly. ACL replaces a zero seed value with a random number.

MINIMUM min

Specifies the minimum allowable value for the generated random numbers. Any valid numeric value or expression is allowed.

MAXIMUM max

Specifies the maximum allowable value for the generated random numbers. Any valid numeric value or expression is allowed.

UNIQUE

Specifies that only unique numbers will be included in the output. When you use UNIQUE, each random number generated is compared to the entire list of previous numbers for this command. When duplication exists, the number is discarded without replacement.

Use UNIQUE only when the range is at least 1/3 larger than the required number of samples. The default behavior of the RANDOM command is to include duplicates.

COLUMNS n

Specifies the number of columns to use for the output.

SORTED

Specifies that the values should be sorted in ascending sort order. By default the output is not sorted.

TO SCREEN | filename
  • Specify TO SCREEN to display the results in the ACL display area.

  • Specify TO filename to save the results to a file. You must specify the filename value as a quoted string with the appropriate file extension. For example, specify the .TXT file extension to create a text file.

    For example: TO "Output.TXT"

    You can also specify an absolute or relative file path to save the file to an existing folder.

    For example: TO "C:\Output.TXT" or TO "Results\Output.TXT"

APPEND

Optional. Specifies that command output is appended to the end of an existing file instead of overwriting it. When using this parameter, you must ensure that the structure of the command output and the existing file is identical, if maintaining a consistent file structure is important (for example, when you are appending data to an existing ACL table), because ACL appends output to an existing file regardless of its structure.

Example

The following example creates a text file with 100 random values between 10000 and 100000. The values are written in 1 column and sorted.

RANDOM NUMBER=100 SEED = 45387 MINIMUM 10000 MAXIMUM 100000 COLUMNS 1 SORTED 
TO "RandomValues.txt"


(C) 2015 ACL Services Ltd. All Rights Reserved.