SourcePoint Intel Help

Table of Contents

rand

Return a random number.

Syntax

[result =] rand()

Where:

result

specifies a debug variable of type int4 to which the function return value is assigned. If name is not specified, the return value is displayed on the next line of the screen.

Discussion

Return a pseudo-random number of int4 data type. If you previously executed the srand function, the rand function uses the output of the srand function as its source expression. If the srand function has not been previously executed, the rand function generates a less-random number.

Example

The following example illustrates the srand and rand functions:

Command input:

define int4 card
srand(3)
card = rand()
card

Result:

16838T                // result may vary

Command input:

rand()

Result:

5758T                 // result may vary

Related Topics: