CAPL Script

Random

This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.

Syntax

dword random(dword x);

Function

Calculates a random number between 0 and x-1.

Parameters

Determines the interval.

Return Values

Random number between 0 and x-1.

Reference example from the CANoe 12 help. Check the required configuration, database objects and API availability in your installed version; this is not a recorded compiler or runtime test.

dword x;
// generate random number in the interval [0;99]
x = random(100);