Skip to main content

Random Number

Instruction Parameters

Supported PLC Series

XPnA/1RXPnBXPnEXPnFCP3A/B/P/U
CP4A~D/U
CPnECPnFBPPLC-S

Supported Data Registers

MXYKLFTCSZRQD@DConstant
D-----

Supported Flags

FlagBitSupport
ErrorF11.0
ZeroF11.1-
CarryF11.2-

Number of Steps

Steps
3

Operands

OperandDescription
DThe only operand.
Entries are only WORD data registers.
This is where the random number is stored.

The value range of the generated number is 0 ~ 32,767 (215-1).

Notice

Error Flag (F11.0) Notice

The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type.

Instruction Behavior

The RND and RNDP instructions behave as follows:

  • The number randomly generated will be in the range of 0 ~ 32,767 (215-1).
    • The generation of a random number is based on an internal calculation formula.

Examples