Use DBMS_RANDOM, a PL/SQL supplied package.