Before you can use the DBMS_RANDOM package, you must initialize it with this program.PROCEDURE DBMS_RANDOM.INITIALIZE (seed IN BINARY_INTEGER); seed The seed number used in the algorithm to generate a random number. You should provide a number with at least five digits to ensure that the value returned by the DBMS_RANDOM.RANDOM function will be sufficiently, well, random.The INITIALIZE procedure does not assert a purity level with the RESTRICT_REFERENCES pragma. ExampleHere is an example of a call to initialize the DBMS_RANDOM package:SQL> exec DBMS_RANDOM.INITIALIZE (309666789);then Call the RANDOM function to retrieve a random number.FUNCTION DBMS_RANDOM.RANDOM RETURN BINARY_INTEGER;The RANDOM runction does not assert a purity level with the RESTRICT_REFERENCES pragma. ExampleHere is an example of a call to RANDOM to obtain a random number:DECLARE my_random BINARY_INTEGER; BEGIN my_random := DBMS_RANDOM.RANDOM;
seed The seed number used in the algorithm to generate a random number. You should provide a number with at least five digits to ensure that the value returned by the DBMS_RANDOM.RANDOM function will be sufficiently, well, random.The INITIALIZE procedure does not assert a purity level with the RESTRICT_REFERENCES pragma.
ExampleHere is an example of a call to initialize the DBMS_RANDOM package:SQL> exec DBMS_RANDOM.INITIALIZE (309666789);then
Call the RANDOM function to retrieve a random number.FUNCTION DBMS_RANDOM.RANDOM RETURN BINARY_INTEGER;The RANDOM runction does not assert a purity level with the RESTRICT_REFERENCES pragma.
ExampleHere is an example of a call to RANDOM to obtain a random number:DECLARE
my_random BINARY_INTEGER;
BEGIN
my_random := DBMS_RANDOM.RANDOM;