Hi,
as the implementation is a bit tricky, here is some example code.
PROGRAM PLC_PRG
VAR
uiNumOfRandomBytes : UDINT := 4;
Result : UDINT;
udiRandom2 : UDINT; // Random number
bsRandomNumber : RtsByteString := (ui32MaxLen:=SIZEOF(uiNumOfRandomBytes), ui32Len:=0, pByData:=ADR(udiRandom2)); //
END_VAR
// This code is working and generates a random number udiRandom2
Result := CryptoGenerateRandomNumber(ui32NumOfRandomBytes:= uiNumOfRandomBytes, pRandom:= ADR(bsRandomNumber));
... View more