dice.sd[i] <- sd(sample(1:6, i, replace = TRUE))
This line creates a sample of size i
, not a sample of size 6, which I assume is what you want. Your i
goes up to 1000, which is large enough for the sample SD to be close to the population SD.
What you want is
dice.sd[i] <- sd(sample(1:6, 6, replace = TRUE))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…