The randomVariable operator generates sample data from a discrete or continuous distribution. The Operand is a distribution function. The left argument contains the parameters to the distribution, and the right argument indicates the number of replications.
The right argument is usually an integer scalar, but if it is an integer vector, then it represents the shape of the result.
If the distribution function is normal or rectangular, the left argument defaults to 0 1.
The syntax of the randomVariable operator is:
[Parameters|0 1] distributionFunction randomVariable Integer1 [Integer2]
Toss 5 fair coins 10 times and count the number of heads:
10 0.5 binomial randomVariable 10
1 4 3 3 3 1 2 3 2 2
Generate a sample of five from the standard normal distribution,
normal randomVariable 5
¯0.18711 1.49367 ¯1.56559 1.04212 ¯2.06884
Generate a sample of 100 student heights with a mean of 68 and a standard deviation of 3
HTS←68 3 normal randomVariable 100
6↑HTS
679.973 67.615 64.061 72.555 65.394 66.455
(mean,sdev)HTS
68.198 2.918