Then, we have to list all wanted results. Which is basically all possible set of pairs, and each set has two wanted result where the first pair adds up to 7 and the second pair adds up to 9, or vice-versa. And which we got:
Set 1 = (D1+D2==7 and D3+D4==9) or (D1+D2 ==9 and D3+D4==7)
Set 2 = (D2+D3==7 and D1+D4==9) or (D2+D3 ==9 and D1+D4==7)
Set 3 = (D2+D4==7 and D1+D3==9) or (D2+D4 ==9 and D1+D3==7)
After that, we can make the code that runs the simulation multiple time and when there is a run that has one of the wanted result, it return a 1, likewise, it returns 0.
Lastly, we can run the simulation multiple times, and add up all the 1 and divide it by the total run to obtain the probabilty. Which in this case we run it 10000 times
Based on our simulation, in which we rolled it 100000 times, if we were to roll four dice, the probabilty of getting a result where we can one pair up the dice with one pair adds up to seven and another pair add up to 9 is 7.399%
Computer the probability
We know for 4 dies , total faces could estimate will be 6*6*6*6 . but as the requests, if we pick out D1,D2 , what the face that satisfy the sum(D1,D2)==7 ?
total 4 dice (D1,D2,D3,D4), so the sum(faces of dice upon the requests) satisfy the condition that sum(2 dies) is 7 and another sum(2 dice)=9 will be 4(means 4 dies)*6(sum(2 dies)=7)*4(sum(another 2 dies))=96 sum(faces of 4 dies)=6*6*6*6thus , the probability=sum(faces of requests dies)/sum(faces of 4 dies )
Therefore, theoretically speaking, then probability of getting one pair add up to 7 and the other pair add up to 9 is 7.407%, using 4 6-sided dice.