Validity of DBMS_RANDOM [message #393635] |
Mon, 23 March 2009 17:47 |
random1
Messages: 1 Registered: March 2009
|
Junior Member |
|
|
We are in the process of implementing Oracle 10g. In our line of work, the validity of a random number sequence used in selecting a random sample is often challenged in court. Do you know if DBMS_RANDOM has been validated against a generally accepted battery of tests? If so, can the documentation be shared?
|
|
|
|
Re: Validity of DBMS_RANDOM [message #393650 is a reply to message #393635] |
Tue, 24 March 2009 00:19 |
|
Michel Cadot
Messages: 68718 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
It is a pseudo-random generator.
If you start with the same seed, you get the same numbers each time:
SQL> begin
2 dbms_random.seed(1);
3 for i in 1..10 loop
4 dbms_output.put_line(dbms_random.value(1,100));
5 end loop;
6 end;
7 /
75.34547976771869083129234252664613265915
86.17819215638169375347849531513072373415
37.16653760309711926185693244452392755564
2.28758657010193991918657865167014887739
56.92037343639320852334524293953345256258
23.55804720091724963562724728741344732548
88.5443995926948887956407307328275888315
66.25086256998010461278569435429033589644
69.48782330434642398348210878163882022771
24.54575062152937589512639607942234360938
PL/SQL procedure successfully completed.
SQL> /
75.34547976771869083129234252664613265915
86.17819215638169375347849531513072373415
37.16653760309711926185693244452392755564
2.28758657010193991918657865167014887739
56.92037343639320852334524293953345256258
23.55804720091724963562724728741344732548
88.5443995926948887956407307328275888315
66.25086256998010461278569435429033589644
69.48782330434642398348210878163882022771
24.54575062152937589512639607942234360938
PL/SQL procedure successfully completed.
As Oracle says:
Quote: | It generates a sequence of random 38-digit Oracle numbers. The expected length of the sequence is about power(10,28)
|
If you don't give a seed, Oracle doc says (http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_random.htm#sthref4646)
Quote: | DBMS_RANDOM can be explicitly initialized, but does not need to be initialized before calling the random number generator. It will automatically initialize with the date, userid, and process id if no explicit initialization is performed.
|
Regards
Micgel
|
|
|