投点试验计算Ln2,编写成R模拟程序如下MC.ln2 <- function(n){ x = runif(n,1,2) y = runif(n,0,1) sum( y < 1/x ) / n}MC.ln2(10000)这是一次模拟,如果进行1000次模拟再平均,R语句如何实现?
A.
ys = replicate(1, MC.ln2(1000)) mean(ys)
B.
ys = replicate(100, MC.ln2(1000)) mean(ys)
C.
ys = replicate(1000, MC.ln2) mean(ys)
D.
ys = replicate(1000, MC.ln2(1000)) mean(ys)