RANDOM macro

The RANDOM macro is available only in Unica Campaign.

Syntax

RANDOM(num [, seed]) RANDOM(num, value1, value2 [, seed])

Parameters

num

The number of random numbers to generate. This value must be a positive integer greater than zero.

value1

A bound on the random numbers to generate. This can be any constant value or an expression evaluating to a constant. If this parameter is not provided, the default is zero.

value2

The other bound on the random numbers to generate. This can be any constant value or an expression evaluating to a constant. If this parameter is not provided, the default is one.

seed

An optional seed to use for random number generation. This must be an integer.

Description

RANDOM generates a column of random numbers. It returns one new column containing num random numbers. If value1 and value2 are specified, the random numbers will be generated between (and including) those bounds. If they are not specified, the default is to generate values between zero and one. If seed is provided, it will be used as a seed to the random number generator.

Note: If seed is greater than or equal to , the value is replaced with 2 32- 1. Values of seed above will be rounded (that is, precision is lost). Therefore, multiple values may result in the same value of seed.

Examples

TEMP = RANDOM()

Creates one new column named TEMP containing random numbers of unlimited length.

TEMP = RANDOM(100)

Creates one new column named TEMP containing 100 random numbers between 0.0 and 1.0.

TEMP = RANDOM(100, 5943049)

Creates one new column named TEMP containing 100 random generated from the seed number 5943049.

TEMP = RANDOM(100, 0, 100)

Creates one new column named TEMP containing 100 random numbers between 0 and 100.0.

TEMP = RANDOM(100, 0, 100, 5943049)

Creates one new column named TEMP containing 100 random numbers between -0 and 100 generated from the seed number 5943049.

Related Functions

Function Description
RANDOM_GAUSS Returns the specified number of random values from a Gaussian distribution