Random number generator (included): Difference between revisions

Add PL/SQL
m (Link cryptographic hash function to a local page, not Wikipedia. I will create the page.)
(Add PL/SQL)
Line 295:
<lang PL/I>seed(x) = mod(950706376 * seed(x-1), 2147483647)
random(x) = seed(x) / 2147483647</lang>
 
=={{header|PL/SQL}}==
Oracle Database has two packages that can be used for random numbers generation.
 
===DBMS_RANDOM===
The DBMS_RANDOM package provides a built-in random number generator. This package is not intended for cryptography.
It will automatically initialize with the date, user ID, and process ID if no explicit initialization is performed.
If this package is seeded twice with the same seed, then accessed in the same way, it will produce the same results in both cases.
<lang PL/SQL>DBMS_RANDOM.RANDOM --produces integers in [-2^^31, 2^^31).
DBMS_RANDOM.VALUE --produces numbers in [0,1) with 38 digits of precision.</lang>
 
===DBMS_CRYPTO===
The DBMS_CRYPTO package contains basic cryptographic functions and procedures.
The DBMS_CRYPTO.RANDOMBYTES function returns a RAW value containing a cryptographically secure
pseudo-random sequence of bytes, which can be used to generate random material for encryption keys.
This function is based on the RSA X9.31 PRNG (Pseudo-Random Number Generator).
<lang PL/SQL>DBMS_CRYPTO.RANDOMBYTES --returns RAW value
DBMS_CRYPTO.RANDOMINTEGER --produces integers in the BINARY_INTEGER datatype
DBMS_CRYPTO.RANDOMNUMBER --produces integer in the NUMBER datatype in the range of [0..2**128-1]</lang>
 
=={{header|PowerShell}}==
Anonymous user