SAMPLE sizeNumber dataVector resultVariable

Randomly (uniformly with replacement) selects a number (size) of elements from the input vector and replaces the contents of the result variable with them. Since this selection is with replacement it is as if the input vector is infinitely large. Thus, size can be larger than the length of the input vector.

To create samples without replacement, use the SHUFFLE and the TAKE commands.

GENERATE, RANDOM, and SAMPLE are synonyms.

COPY 1,10 A
SAMPLE 5 A B
PRINT B

Two consecutive runs of the above program produced this:

B: (2.0 9.0 5.0 4.0 1.0)
B: (9.0 4.0 3.0 10.0 4.0)