Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-02 |
|
|
View PDF |
The RANDOM function produces a number that is randomly distributed between specified low and high boundaries. Randomly generated numbers are useful when building and duplicating tests of applications. They are especially useful for simulation and forecasting applications.
Tip:
To compute the number, RANDOM uses the values of the options RANDOM.SEED.1 and RANDOM.SEED.2, and then changes the values for the next time. When you create your own seeds, set both RANDOM.SEED.1 and RANDOM.SEED.2 to odd numbers. This practice enhances the randomness of the numbers that are produced.Return Value
DECIMAL
Syntax
RANDOM([lowbound] [highbound])
Arguments
A numeric expression that specifies the lower boundary for the random number series. The default is 0
. When lowbound is NA
, the RANDOM function produces NA
.
A numeric expression that specifies the upper boundary for the random number series. The default is 1
. When highbound is NA
, the RANDOM function produces NA
Examples
Example 22-1 Producing Random Numbers
This example assigns random numbers between 100 and 200 to a variable called test
, which is dimensioned by product
.
test = RANDOM(100 200) REPORT test
These statements produce a report such as the following.
PRODUCT TEST -------------- ---------- Tents 122.93 Canoes 176.69 Racquets 168.32 Sportswear 150.92 Footwear 187.46