Hello everyone, I try to solve the following problem:
Use Monte Carlo simulation to approximate the sum of the 100 consecutive rolls of a fair die.
My work in math lab is:
sum=0;
roll= 100;
for i = 1:roll
numbroll = ceil(6*rand);
sum=sum+numbroll;
end
sum
This code return the sum of 100 rolls.
Back in the book the answer for this exerise said:

Question: I don't know if I missunderstand the statement or not. What is the correct answer? and if someone know how to do the coding for a pair of dice I will be really apreciated.
Thanks for your help !
Electro82 was definitely on the right track - just a couple of mods here and this works: