Function Block RAND

The Function Block RAND generates a random number as an integer.

Tip: If a boolean random value is to be generated, it can be created with MIN=0 and MAX=1. In this case, the PLC evaluates 0 as FALSE and 1 as TRUE.

Input SET

The input generates a random number between MIN and MAX at the output Q on a positive edge.

Input MIN

The input MIN defines the lower limit as an integer.

Input MAX

The input MAX defines the upper limit as an integer.

Output Q

Returns the random number as an integer. If no random number has been generated yet, 0 is output,