Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Random numbers repeating
Make a package and initialize the seed value to-1. If the seed value is -1
then generate one, else don't give it a seed value.
Jim
"Sean" <dolans_at_my-deja.com> wrote in message
news:8vf092$dqu$1_at_nnrp1.deja.com...
> Environment : Win NT 4.0, Oracle 8.1.6 (no java option installed)
>
> Scenario: Made a quick function that returns a 9 digit/character
> string. Works wonderfully. It is seeded with the date time:
> seedValue := to_number( to_char(
> sysdate, 'DDHH24MISS' ) ) ;
> dbms_random.Initialize(seedValue);
>
> and then I do my thing.
>
> Problem: I have a package that needs to call this function multiple
> times to get a series of random strings. The problem is Oracle is so
> fast that my seed value is probably the same each time through which
> results in similar results every time.
>
> For example, :
> BEGIN
> dbms_output.put_line(fn_getRandomString);
> dbms_output.put_line(fn_getRandomString);
> END;
> /
> gives me :
> YYRLKBCTT
> YYRLKBCTT
>
> I need them different. Any ideas on how to change the seedvalue so I
> can get different numbers?
>
> thanks,
> Sean
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Nov 21 2000 - 19:53:18 CST
![]() |
![]() |