First consider what goes into rolling 2d6 10 times and adding the result.
twoDsix <- function(n) {
rolls <- rep(NA, n)
for(i in 1:n) {
rolls[i] <- sum(sample(1:6, 2, replace = T))
}
sum(rolls)
}
sim_results1 <- rep(NA, 50000)
for (j in 1:50000){
sim_results1[j] <- twoDsix(10)
}
Now consider what goes into rolling 2d6 once, and multiplying that result by 10.
sim_results2 <- rep(NA, 50000)
for (i in 1:50000){
sim_results2[i] <- twoDsix(1) * 10
}
We can compare the two distributions:
par(mfrow = c(2, 1))
#sim_results1 <- c(sim_results1, 0, 140)
#sim_results2 <- c(sim_results2, 0, 140)
#barplot(table(sim_results1), main = "Outcomes when rolling 2d6 10 times", col = "steelblue")
hist(sim_results1, main = "Outcomes when rolling 2d6 10 times", col = "steelblue", xlim = c(20, 120))
barplot(table(sim_results2), main = "Outcomes when rolling 2d6 once and multiplying by 10", col = "steelblue")
#hist(sim_results2, main = "Outcomes when rolling 2d6 once and multiplying by 10", col = "steelblue", xlim = c(0, 140))
var(sim_results1)
## [1] 58.32
var(sim_results2)
## [1] 577.9
Thus consolidating the randomness into a single roll instead of 10 increases the variance by a factor of one hundred.