A die is rolled three times. Find the probability that the sum of the outcomes is (a) greater than 9. (b) an odd number.
Utilizing the dice rolling function utilized in discussion 5
dice.sim<- function(n.dice){
dice <- sample(x = 1:6, size = n.dice, replace = TRUE)
return(sum(dice))}
n=3
q1a <- (dice.sim(n))/(6^n)
q1a
## [1] 0.06481481
The previous dice function did not work as I thought it would since the value changes every time it runs
q1 <- rep(0,1)
for (d1 in 1:6)
for (d2 in 1:6)
for (d3 in 1:6)
{s <- d1+d2+d3
q1[1] <- q1[1]+((s>9))}
(q1a <- q1/6^3)
## [1] 0.625
As to question (b), since dice are only have odd or even values, the probibility is 50% of any roll being odd.