Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: dbms_random question
OK,
so I've changed the code to this:
dbms_random.initialize(TO_NUMBER(TO_CHAR(SYSDATE, 'SSSSS')));
nMagic:=dbms_random.random;
dbms_random.terminate;
Then the numbers seems to change. But my question is - is this the correct way, how the generator should be used?
Pavel
"Pavel Vetesnik" <Pavel.Vet_at_volny.cz> píše v diskusním příspěvku
news:baigpb$2e53$1_at_ns.felk.cvut.cz...
> 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
>
>
Received on Thu May 22 2003 - 08:08:21 CDT
![]() |
![]() |