Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Good random number source in oracle

Re: Good random number source in oracle

From: Frank Hubeny <member_at_dBforums.com>
Date: Thu, 03 May 2001 21:32:52 GMT
Message-ID: <88kI6.57700$E63.729434@news1.onlynews.com>

Others have discussed seed values for a random function.

It is also important that the algorithm generating the random number is acceptable.

Without passing judgment on dbms_random, one has the option of using the C functions "rand" or "random" as well.

These functions are available in libc.so and some documentation on them is available through "man". To make them available in Oracle, do the following:

(1) Create a library, such as TEST:ORACLE> create or replace library

    libc as '/usr/lib/libc.so.1';
   2 /

Library created.

(3) Create a function to use "random" as follows: TEST:ORACLE>

    create or replace function random 2 return binary_integer 3 is     external library LIBC name "random" 4 calling standard c     parameters(return long);
   4 /

Function created.

(5) Experiment with the new function: TEST:ORACLE> select random

    from dual;

    RANDOM



1027100827
--
Posted via dBforums
http://dbforums.com
Received on Thu May 03 2001 - 16:32:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US