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: Robert Jefson <rjefson_at_highway1.com>
Date: 1997/03/31
Message-ID: <3340649F.5761@highway1.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

There's an example of a random number generation package in Scott Urman's Oracle Press Book: 'Oracle PL/SQL Programming' (page 241). I'm just starting out in PL/SQL programming, am halfway through the book, and would definitely recommend it (I've also the two Feuerstein books that I'll be digging into next). Anyway, the random number function is seeded on package initialization to the current time in seconds, which is something I suppose you could do before each call.

-Rob Received on Mon Mar 31 1997 - 00:00:00 CST

Original text of this message

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