rand

Returns a pseudo random integer.

int rand(void)

The rand function returns a pseudo random integer. The value returned is a weak pseudo random number and Oracle doesn't recommend using it for any cryptographic application.

Example 7-38 How to use rand to generate a pseudo random integer

The example uses the trace function to print the generated integer in the trace output.

BEGIN{ 
   trace(rand()); 
}