A.5. DBMS_RANDOMThis package contains programs that generate random values (numbers or strings) and perform other randomization operations.
This program initializes the DBMS_RANDOM package with a user-specified "seed" that will be used to generate random values. Having a different seed value for different programs ensures the generation of sufficiently random values. SEED is overloaded: both versions are functions, each accepting a parameter of a different datatype. FunctionVersion 1Accepts a single parameter, val, which will be used as the seed value. The parameter is a VARCHAR2 value, which may be up to 2,000 bytes. FunctionVersion 2Accepts a single parameter, val, which will be used as the seed value. The parameter is a BINARY_INTEGER value.
This program returns a random number: a positive, floating-point number less than one. VALUE is overloaded: both versions are functions, one with parameters and one without. FunctionVersion 1 (no parameters)Returns a random number in the NUMBER datatype. There are no parameters. FunctionVersion 2 (parameters)Returns a random number in the NUMBER datatype. This version accepts two input parameters: low and high. The returned value will be between the low and high values.
This function returns a random string. This string is of a user-specified length and distribution of characters. It accepts two input parameters.
The opt parameter may have any of the values shown in the following table.
This function, like the VALUE function, returns a random number. However, the pattern of random number generation for NORMAL follows a normal distribution. That means that if you execute this function several times in succession, the generated numbers will follow a random number distribution. The NORMAL function has no input parameters. |