7: B
INARY
A
RITHMETIC
I
NSTRUCTIONS
7-18 FC6A S
ERIES
MICROS
MART
L
ADDER
P
ROGRAMMING
M
ANUAL
FC9Y-B1726
RNDM (Random)
*1 0 to 32,767 can be input.
For the valid device address range, see "Device Addresses" on page 2-1.
• When the data in S1 or S2 is outside the range of 0 to 32,767, the result is a user program execution error.
• When the data specified by S1 is the same value as the data specified by S2 or a larger value, the result is a user program execution error.
For user program execution errors, see "User Program Execution Errors" on page 3-10.
Valid Data Types
Example: RNDM
Device Function I Q M R T C D P Constant Repeat
S1 (Source 1) Minimum value of pseudorandom numbers — — — — — — X — X
*1
—
S2 (Source 2) Maximum value of pseudorandom numbers — — — — — — X — X
*1
—
D1 (Destination 1) Destination to store results — — — — — — X — — —
W (word) X
When a word device such as D (data register) is designated as the source or destination, 1 point (word) is
used.
I (integer) —
D (double word) —
L (long) —
F (float) —
Generates pseudorandom numbers.
When the input is on, a pseudorandom number is generated with the data specified by
S1 as the lower limit and the data specified by S2 as the upper limit, and that value is
stored in D1.
The result is stored to the destination designated by device D1.
D1
*****
S1
*****
S2
*****
RNDM(W)
D1
D0010
S1
1
I0
RNDM(W) S2
6
SOTU
When the input is turned on, a pseudorandom number is generated in the
range of 1 to 6, and the result is stored in D0010.