jeudi 19 juillet 2018

Why does runif() have less unique values than rnorm()?

If you run code like:

length(unique(runif(10000000)))
length(unique(rnorm(10000000)))

you'll see that only about 99.8% of runif values are unique, but 100% of rnorm values are. I thought this might be because of the constrained range, but upping the range to (0, 100000) for runif doesn't change the result. Continuous distributions should have probability of repeats =0, and I know in floating-point precision that's not the case, but I'm curious why we don't see fairly close to the same number of repeats between the two.




Aucun commentaire:

Enregistrer un commentaire