[R] ties in runif() output
Douglas Grove
dgrove at fhcrc.org
Sat Jun 26 00:15:16 CEST 2004
I get ties in output from runif() when I generate as few as 10^5
variates and get quite a lot when I generate 10^6. Is this
expected?? I haven't seen any duplication with rnorm(10^6), but
see varying amounts of duplication using rexp(), rbeta() and
rgamma(). I would have thought that there'd be enough precision
that one wouldn't get ties until generating samples larger than this..
> set.seed(222)
> sum(duplicated(runif(10^5)))
[1] 4
> sum(duplicated(runif(10^6)))
[1] 140
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status Patched
major 1
minor 9.0
year 2004
month 04
day 13
language R
Thanks,
Doug Grove
More information about the R-help
mailing list