Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Random Number
This is a multi-part message in MIME format.
--------------F142F95774917FD4ECC9844F Content-Type: text/plain; charset=us-ascii Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit
The easiest way I know is to use some function on sysdate, such as the taking the lower bytes of the numeric form (the subsecond portion), squaring it, and then normalizing it to your range. The advantage of using time is it can be argued to be a truly random number when using a consistent range of the time for the expected intervals of the queries (grabbing one millisecond of 1000 through a RDBMS on a multi-tasking operating system is in fact a random event).
NetAccess News wrote:
> Can anyone tell me a fairly easy way to generate a psuedo random
> number in
> Oracle - must I use time?
> Fanx
>
> Aotea Software
> Aotearoa (NZ)
--------------F142F95774917FD4ECC9844F Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Someone Content-Disposition: attachment; filename="vcard.vcf" begin: vcard fn: Someone n: ;Someone email;internet: answers_at_erols.com.tyfns title: Important note: Remove tyfns from my email address to reply. TYFNS stands for "Thank you for not spamming."x-mozilla-cpt: ;0
--------------F142F95774917FD4ECC9844F-- Received on Fri Oct 03 1997 - 00:00:00 CDT
![]() |
![]() |