I'm building a distribution of proportions of random values lower than a specified threshold.
ret = c(); thr = 0.5; n = 15; reps = 10000
for (x in 1:reps) {
prop = sum(runif(n, 0, 1) < thr) / n
ret = c(ret, prop)
}
plot(density(ret), main=NA)
The resulting density distribution is highly periodic and is not something one would theoretically expect:
I presume this has something to do with the periodicity of the random number generator. Is there any way around this?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…