Seed a random value with dbms_random.seed : DBMS_RANDOM « System Packages « Oracle PL / SQL






Seed a random value with dbms_random.seed

   
SQL>
SQL>  set serverout on
SQL>  exec dbms_random.seed( to_char( sysdate, 'YYYYMMDD' ) );

PL/SQL procedure successfully completed.

SQL>  exec dbms_output.put_line( dbms_random.value );
.09697957992149808336891757660029645577

PL/SQL procedure successfully completed.

SQL>  exec dbms_output.put_line( dbms_random.value );
.07915501486927581930051571448998022468

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL>  set serverout on
SQL>  exec dbms_random.seed( to_char( sysdate, 'YYYYMMDD' ) );

PL/SQL procedure successfully completed.

SQL>  exec dbms_output.put_line( dbms_random.value );
.09697957992149808336891757660029645577

PL/SQL procedure successfully completed.

SQL>  exec dbms_output.put_line( dbms_random.value );
.07915501486927581930051571448998022468

PL/SQL procedure successfully completed.

SQL> --

   
    
  








Related examples in the same category

1.ROUND a DBMS_RANDOM.VALUE
2.This script illustrates the use of the DBMS_RANDOM package.
3.Call dbms_random.normal to get a random number
4.Use dbms_random.string to create random string
5.dbms_random.value
6.Random string with dbms_random.string
7.Round a random value from dbms_random.value
8.trunc a random value from dbms_random.value
9.mod(abs(dbms_random.random),50000)+1
10.Insert random numbers into a table
11.Insert random value to table