Is there a way to generate identical random samples using R's runif
function and SAS's ranuni function?  I have assigned the same seed
values in both software packages, but the following results show
different results.   Thanks!

R
===
> set.seed(6)
> random <- runif(10)
> random
 [1] 0.6062683 0.9376420 0.2643521 0.3800939 0.8074834 0.9780757
0.9579337
 [8] 0.7627319 0.5096485 0.0644768

SAS (the log file)
=======
15         data _null_;
16           do i=1 to 10;
17              random = ranuni(6);
18              put i= random=;
19              end;
20         run;

i=1 random=0.1097754189
i=2 random=0.8205322939
i=3 random=0.3989458365
i=4 random=0.5563918723
i=5 random=0.5296154672
i=6 random=0.8156640985
i=7 random=0.2578750389
i=8 random=0.1901503369
i=9 random=0.2987641572
i=10 random=0.3993993096

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to