DRAND
The function block permits generation of a (pseudo-) random number of type LREAL.
Inputs
VAR_INPUT
Seed : INT;
END_VAR
Name | Type | Description |
---|---|---|
Seed | INT | Initial value for specification of the random number series. |
Outputs
VAR_OUTPUT
Num : LREAL;
END_VAR
Name | 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.
Requirements
Development environment |
Target system type |
PLC libraries to include (Category group) |
---|---|---|
TwinCAT v3.1.0 |
PC or CX (x86, x64, ARM) |
Tc2_System (System) |