Oracle Cryptographic Toolkit Programmer's Guide Release 2.0.3 A54082-01 |
|
This chapter discusses the Oracle Cryptographic Toolkit random number generator. The following topics are covered:
The random number generator is built on top of the Oracle Cryptographic Toolkit. This tool is intended for users who want to generate random data for their applications.
The random number generator is composed of the following:
This procedure is used before the random number generator package is called. The procedure takes a seed which initializes the random number generator. The seed can be any value between -9999999999 and 9999999999.
Note:
You must call this procedure before using any of the other procedures or functions. Otherwise, an exception will be raised. |
This procedure resets the seed used by the random number generator.
The function returns a random number between -9999999999 and 9999999999.
This procedure must be called when the package is no longer needed.
The following code fragment is an example of how to use the random number generator package.
DECLARE i BINARY_INTEGER; BEGIN dbms_random.initialize(19254); i := dbms_random.random; INSERT INTO some_table VALUES(i); dbms_random.terminate; END;
Note:
It is not currently possible to use the return value of RANDOM directly in a SQL statement. The following is not allowed, for example: INSERT_INTO some_table VALUES(DBMS_RANDOM.RANDOM); |