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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Random Number Generation in PL/SQL

Re: Random Number Generation in PL/SQL

From: Eduardo Rene Rodriguez Avila <eravila_at_geocities.com>
Date: 1997/04/04
Message-ID: <334532E6.7674@geocities.com>#1/1

Jeffrey P. Rudnick wrote:
>
> Has anyone come across a random number generation function written in
> PL/SQL? We are in need of random number generation over a variable
> domain of numbers. For example: we may need 20 random numbers between 1
> and 75, and later 30 random numbers between 1 and 2,000.
>
> Some of the algorithms we tried to implement from textbooks
> (pseudo-random number generation) go into loops which repeat the
> same number sequence after a short period of time.
>
> If anyone has a PL/SQL random number algorithm they can share, we would
> greatly appreciate it.
>
> Regards,
>
> rudnijp_at_hpd.abbott.com

   Well, some time ago a write this for an simple application:

    .
    .
    .
   IF seed=0 THEN 
        seed := EXP(TO_NUMBER(TO_CHAR(SYSDATE,'SS'))/59);
   END IF;
   seed := 1/(seed - TRUNC(seed));
   seed := seed - TRUNC(seed);
    .
    .
    .


   I hope be useful...

-- 
                                                 Saludos desde México...
                                                   Greetings from
Mexico...
                                                             _/ _/
M. en C. Eduardo Rene Rodriguez Avila                     _/     _/
                                                           _____/
Database and UNIX Systems Administrator, 
Technical Support, MIS,                       E-Mail:
e.r.rodriguez_at_ieee.org                           
Cablevision, S.A. de C.V.                            
eravila_at_spin.com.mx    
D.F., Mexico.                                   WWW :
http://spin.com.mx/~eravila
===============================================================================================
                                                                          
__ __
Received on Fri Apr 04 1997 - 00:00:00 CST

Original text of this message

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