DBMS_RANDOM package

The DBMS_RANDOM package provides a mechanism for generating random numbers. Use the INITIALIZE procedure to set the seed value, which is used by the random number generator to generate the numbers.

After enough repetitions, it is possible that some of the generated values will repeat. To reduce the possibility of repeating values, periodically change the seed value by using the SEED procedure.

The DBMS_RANDOM package includes the following system-defined routines and types.

Table 1. System-defined routines available in the DBMS_RANDOM package
Routine name Description
INITIALIZE procedure Initializes the package with the specified integer seed value. Optional.
SEED procedure Resets the seed with the specified integer value.
RANDOM function Uses the existing seed value to return a random integer.
TERMINATE procedure Terminates the package by resetting the seed value to 0. Optional.