Example: srand

The following example generates 2 random numbers, each kept within a specific range using the mod (%) operator.

 // Srand is called before rand 
    srand(time(NULL)); 
// Generate some random numbers 
    lr_output_message ("A number between 0 and 100: %d\n", rand() % 100); 
    lr_output_message ("A number between 20 and 30: %d\n", rand() % 10+20); 
Example: Output:
Action.c(7): A number between 0 and 100: 72
Action.c(8): A number between 20 and 30: 28