RND
RND, RNDP, SRND, SRNDP
RND instruction produces a random sequence of numbers to Destination.
SRND instruction changes the seed of the Source (random sequence of numbers).
(It supports only in XP and PLC-S CPU series)
| |
S | Source |
D | Destination |
Instruction | Device address | No. of Steps | Flag | |||||||||||||||
M | X | Y | K | L | F | T | C | S | Z | D | @D | Int. |
| Error | Zero | Carry | ||
RND(P) SRND(P) | S | o | - | o | o | o | - | o | o | - | o | o | o | o | 2 | o | - | - |
D | o | - | o | o | o | - | o | o | - | o | o | o | o |
RND, RNDP
Format : RND D(Destination)
When enabled, RND instruction generates a random sequence of numbers to Destination.
Example)
If M00 is ON, the RND instruction produces a random sequence of numbers to the D100.
SRND, SRNDP
Format : SRND S(Source)
When enabled, SRND instruction sets its arguments as the seed for a new sequence of random integers to be returned by RND instruction.
SRND instruction will seed the random number generator to prevent random numbers from being the same every time the program is executed and to allow more pseudo randomness.
Example)
If M01 is ON, the SRND instruction changes the seed of Source that is generated by RND instruction.