Returns one or more uniformly distributed floating-point pseudo-random numbers over the range 0 < Y 1.0.
dimi (optional) The dimensions of the result. May be any scalar expression. Up to eight dimensions may be specified.
PLOT, HISTOGRAM(FIX(6 * RANDOMU(S, 10000)) + $ FIX(6 * RANDOMU(S, 10000)) + 2)
RANDOMU(S, 10000)
is a 10,000-element floating-point array of random numbers greater or equal to 0 and less than 1. Multiplying this by 6 converts the range to 0 Y 6.Applying the FIX function yields 10,000-point integer vectors from 0 to 5, one less than the numbers on one die. This is done twice, once for each die, and then 2 is added to obtain a vector from 2 to 12, the total of two die.
The HISTOGRAM function makes a vector in which each element contains the number of occurrences of dice rolls whose total is equal to the subscript of the element.
This vector is plotted by the PLOT procedure.