Re: PL-SQL Random Number Generator?

From: Jeffery Cann <jcann_at_fairway.com>
Date: 1998/08/14
Message-ID: <35D492ED.36F6E7E3_at_fairway.com>#1/1


Todd Weaver wrote:
>
> this may be a pissant question, but why not use a sequence, and simply use
> ORACLE's random assignment from that sequence? Assign the sequence no
> maximum number, and don't choose the numbers in order..... I suppose this
> may be limiting, as far as security, or where you can access the number
> from, but for simply purposes, is this not a viable alternative?

Because I am implementing a system where results must be assigned randomly. Although one can argue that a computer "can never generate a random number", several random number algorithms have proven to be ~99% random.
I think your suggestion about using a sequence is a good idea but will not work for this situation. Why? Because a sequence will repeat at some point. At least with a some random number generators, the size of that sequence will be large and unlikely to repeat:

from Kevin Taufner's UTIL.PKG:
(posted to archives section of http://www.revealnet.com/pipeline.htm)

  || Purpose: Modifies the method used to calculate a random value  within the
[Quoted]   || package function RAND. A value of [1] uses the  Multiplicative
[Quoted]   || Congruential method (which produces about 2.57E8 results)  and a
[Quoted]   || value of [2] utilizes a Rectangularly Distributed  Statistical
[Quoted]   || method which results in about 6.95E12 values.

Thanks  

> -Veeb
>
> Hakan wrote in message <35D2645D.6F0586C1_at_ibm.net>...
> >Hi,
> >
> >The following source code belongs to Oracle Guru, Mr.Thomas Kyte. It was
 not
> >difficult to find since I use it.
> >
 

-- 
Jeffery Cann
[Quoted] Fairway Systems, Inc.
Senior Software Engineer
Received on Fri Aug 14 1998 - 00:00:00 CEST

Original text of this message