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: DBMS_RANDOM

Re: DBMS_RANDOM

From: <markp7832_at_my-deja.com>
Date: Sat, 25 Mar 2000 18:38:33 GMT
Message-ID: <8bj138$1fp$1@nnrp1.deja.com>


In article <8bg5jt$a3c$1_at_bob.news.rcn.net>, "Eugene Firyago" <efiryago_at_bisys.com> wrote:
> Does anybody use DBMS_RANDOM?
>
> My task is to have numbers randomly generated between 0 and 365 in
PL/SQL. I
> tried to use DBMS_RANDOM (8.1.6) but I couldn't understand how does
it work.
> The +/- numbers it generates are so huge and have no clear dependency
on
> SEED parameter that's only one available to adjust generating.
>
> Any idea?
>
> Thanks,
> Eugene.
>

Eugene, It was a very long time ago but in college I learned the way to produce return values within a range using a random number generator is to take the result of the generator and divide it by the size of the range and take the remainder, i.e., use the mod function on the result of the call.

What do you mean by 'have no clear dependency on SEED parameter'?

--
Mark D. Powell -- The only advice that counts is the advice that you follow so follow your own advice --

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sat Mar 25 2000 - 12:38:33 CST

Original text of this message

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