SAMPLE_RANDOM
Syntax
SAMPLE_RANDOM(num_samples, data [, seed])
Parameters
num_samples
The number of samples to take from each column in the specified data range.
data
The values to randomly sample. This can be a constant value, a column, a cell range, or an expression evaluating to any of the above. For the format definition of data, see the "Macro Function Parameters" section in the chapter in this guide for your IBM® product.
seed
An optional seed to use for random number generation. This must be an integer. (If a non-integer value is supplied, the floor of the value is automatically used instead.)
Description
SAMPLE_RANDOM randomly samples the specified data range. It returns one new column for each input column, each containing num_samples numbers randomly sampled from the corresponding input column of data. Samples are taken in the order they appear in each column (that is, data values will remain in the same relative order to each other). If seed is provided, it will be used as a seed to the random number generator.
Examples
Creates a new column named TEMP with 100 cells all containing the value 3.
Creates a new column named TEMP containing 100 values, where each value is a random sample of the contents of column V1.
Creates three new columns named TEMP, VX, and VY, each containing 50 values. The values in the TEMP column are random samples from column V1, the values of the VX column are random samples from column V2, and the values of the VY column are random samples from column V3.
Creates three new columns named TEMP, VX, and VY, each containing 41 values. The values in the TEMP column are random samples from cells 10-50 of column V1, the values of the VX column are random samples from cells 10-50 of column V2, and the values of the VY column are random samples from cells 10-50 of column V3. The other cells in TEMP are empty.
Related Functions