Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: dbms_random question
Random does NOT mean without repeating. If you have a jar with 10 marbles
and each marble has a different number on it. The random number generator
is like choosing a marble and then putting the marble back in the jar and
choosing again. This is called choosing with replacement. You can get the
same number again. If you are looking for a random number generator that
draws a new marble each time and the does not replace the marble back into
the jar then you are going to have to keep track of all the marbles drawn
and ignore those that came up before.
Jim
-- Replace part of the email address: kennedy-down_with_spammers_at_attbi.com with family. Remove the negative part, keep the minus sign. You can figure it out. "Pavel Vetesnik" <Pavel.Vet_at_volny.cz> wrote in message news:baigpb$2e53$1_at_ns.felk.cvut.cz...Received on Thu May 22 2003 - 09:22:50 CDT
> Hello,
>
> I want to generate a random number (to create an unique password). I
> thought, the dbms_random package was created for this purpouse.
>
> I use such code:
> ============================
> nMagic NUMBER(11);
>
> dbms_random.initialize(5);
> nMagic:=dbms_random.random;
> dbms_random.terminate;
> ============================
>
> But I always get the same number (1034085445 in this case)!
> Giving different 'seed' parameter (5 above), I can get different numbers,
> but the same 'seed' means the same number.
> So what that means? To create a random number I must pass a random number
to
> the generator?!
>
> Please can you help me with this?
> Thank you in advance,
> Pavel
>
>