00:01
For this problem, we are asked to simulate 100 throws of two fair dice, and to calculate the estimated probability that the result is a double six.
00:09
So the way that we'll do that here, i'm using wolfram mathematica, but the logic of the programming should apply universally.
00:16
We'd start with n -equal zero, which counts number of heads.
00:21
Or not number of heads, excuse me, number of double -sixes.
00:26
Then i'll start a four loop, where we start the incremental i at zero.
00:32
For i less than 100, and we increment i by one each time.
00:37
Then for the body of the four loop, we'll generate our number, which is going to be the sum of two different random integer choices between one and six.
00:47
We'll have random integer between one and six, plus random integer between one and six.
00:54
Then i'll have an if statement where we test the value of the num or number.
01:00
If the result is a double six, then we would have to have num equals 12.
01:05
And double six is the only way to have the result equal 12.
01:09
So if that statement is true, num equals 12, then actually we don't want to print anything just yet.
01:16
We'll increment our count by one.
01:19
And if it does not, then we just don't do anything.
01:22
And we want to close our four loop.
01:25
So the last step here is once that four loop has executed, we want to print out probability.
01:33
It's going to be approximately.
01:34
Then we'd have n divided by 100.
01:39
And i'm going to have another approximately squiggle and give n divided by 100 as a decimal...