LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 11 Apr 2008 15:44:19 -0400
Reply-To:     Ya Huang <ya.huang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ya Huang <ya.huang@AMYLIN.COM>
Subject:      Chance that ranuni generate two identical random numbers?

Hi there,

I wonder what's the chance that ranuni, when given a fixed seed, will generate 2 identical random number. It seems that ranuni number is accurate to 14 decimal place. Does it mean that one seed if used more that 10E14 times will start to repeat the itself?

I tested with one million records, and found no duplicate:

35 data xx; 36 do i=1 to 1E6; 37 r=ranuni(0); 38 output; 39 end; 40 format r best32.; 41 run;

NOTE: The data set WORK.XX has 1000000 observations and 2 variables. NOTE: DATA statement used: real time 0.56 seconds cpu time 0.45 seconds

42 43 proc print data=xx (obs=5); 44 run;

NOTE: There were 5 observations read from the data set WORK.XX. NOTE: PROCEDURE PRINT used: real time 0.00 seconds cpu time 0.00 seconds

45 46 proc sql; 47 select * 48 from xx 49 group by r 50 having count(*) > 1 51 ; NOTE: The query requires remerging summary statistics back with the original data. NOTE: No rows were selected.

When I tried to do 1E14, it took too long. So I killed it.

Thanks

Ya


Back to: Top of message | Previous page | Main SAS-L page