DRAND

The function block permits generation of a (pseudo-) random number of type LREAL.
 Inputs
VAR_INPUT
    Seed : INT;
END_VARName  | Type  | Description  | 
|---|---|---|
Seed  | INT  | Initial value for specification of the random number series.  | 
 Outputs
VAR_OUTPUT
    Num : LREAL;
END_VARName  | Type  | Description  | 
|---|---|---|
Num  | LREAL  | This output returns a pseudo-random number in the range 0.0 ... 1.0 with double accuracy. The generator here creates a number series with 1075 stochastic values per period.  | 
Example of the function block in FBD:
 
In the example the LREAL value 0.643412 is generated and returned. The input parameter Seed affects the initial value of the series. If, for instance, a deterministically reproducible random number series is desired in different sessions, and identical Seed value must be used.
Prerequisites
Development Environment  | Target platform  | PLC libraries to be integrated (category group)  | 
|---|---|---|
TwinCAT v3.1.0  | PC or CX (x86, x64, Arm®)  | Tc2_System (system)  |