Dice Rolls and Luck:
Checking Probability by Rolling Two Dice
Figure 1: Screenshot of dice experiment setup
Shibananda Paul
March 12, 2025
Abstract
Using a JavaScript simulation, this experiment explores the probability range for rolling two six-sided dice 200 times. The results indicated that seven were the most common occurrences, nearly matching the expected probability. Minor variations from theoretical expectations occurred due to random variation and the small trial size.
Introduction
Have you ever wondered why casinos consider the number seven lucky? Probability gives the answers by predicting the results of random occurrences, such as dice rolls. Understanding these predictions helps in game planning and statistical analysis. This experiment aims to demonstrate the theoretical probability pattern for dice rolls. Rolling two dice 200 times will likely provide a pattern roughly matching theoretical expectations, with the number seven appearing the most frequently.
Materials and Methods
Materials:
- Spreadsheet software (Microsoft Excel)
- HTML (index.html file)
- JavaScript (script.js file)
- CSS (style.css file)
- Web browser (Brave)
- Computer
Methods:
- Set up HTML file to structure the dice-rolling interface.
- Style the interface using CSS.
- Use JavaScript to simulate dice rolls:
- Record the sum of each roll.
- Repeat this digital simulation precisely 200 times.
- Record and count the frequencies of each sum.
- Create a bar graph to show the results clearly.
Results
After conducting 200 dice rolls, data were collected and summarized in the following table:
Figure 2: Bar Graph of Dice Sum Frequencies
Sum | Frequency |
2 | 5 |
3 | 9 |
4 | 14 |
5 | 21 |
6 | 29 |
7 | 35 |
8 | 28 |
9 | 22 |
10 | 17 |
11 | 12 |
12 | 8 |
Table 1: Frequency Distribution of Dice Sums (200 Rolls)
Analysis
Restating my hypothesis, I predicted that the sum of seven would be the most frequent. The results largely supported the hypothesis. The sum of seven was indeed the most frequent result, which aligns closely with the theoretical expectations, which predict a 16.67% occurrence rate. In the experiment, seven appeared in 17.5% of rolls, a minor but expected variation.
Furthermore, from Figures 2 and 3, the sums of six and eight also appeared frequently (29 and 28 times, respectively). This result aligns with the theoretical probability, as there are more ways to roll sums in the range of six to eight compared to other sums.
Comparatively, Lukac and Engel (2010) did a similar academic study but rolled three instead of two dice. They find out that numbers nine and ten are the most common sums. “The reasons are based on a list of all possible ways of getting the numbers nine and ten using three dice. The total ten has more possibilities than the number nine, so it appears more frequently in repeated random trials. Similarly, median sums are most common to get when totaling the score on multiple dice, because that increases the chance of getting them” (Lukac 38).
Conclusion
This experiment successfully validated theoretical predictions for dice probability. As expected, the sum of seven occurred most frequently. Slight deviations were due to randomness and the limited sample size. This knowledge can be applied practically in game strategies, education, and statistics. Future experiments could involve more trials or different numbers of dice for broader insights.
References
Lukac, S., & Engel, R. (2010). Investigation of probability distributions using dice rolling simulation. Australian Mathematics Teacher, 66(2), 30+. https://link-gale-com.ccny-proxy1.libr.ccny.cuny.edu/apps/doc/A229718040/AONE?u=cuny_ccny&sid=bookmark-AONE&xid=ef400cc7
Appendix
The complete dataset recorded during the experiment in Visual Studio Code web preview is attached to the report.
HTML:
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Pair of Dice Roller</title>
<link rel=”stylesheet” href=”style.css”>
</head>
<body>
<div class=”container”>
<h1>Roll The Dice</h1>
<div id=”dice-container”></div>
<button id=”rollButton”>Roll</button>
</div>
<script src=”script.js”></script>
</body>
</html>
CSS:
body {
margin: 0;
font-family: sans-serif;
background: #5563DE;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.container {
text-align: center;
background: rgba(255,255,255,0.25);
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
#dice-container {
display: flex;
justify-content: center;
margin-bottom: 10px;
perspective: 1000px;
}
#dice-container svg {
width: 70px;
height: 70px;
margin: 0 5px;
transition: transform 1s;
transform-style: preserve-3d;
}
#answer {
color: #fff;
margin-bottom: 10px;
font-size: 18px;
}
button {
padding: 10px 15px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
background: #ff9800;
color: #fff;
}
.rolling { animation: roll 1s; }
@keyframes roll { from { transform: rotateX(0) rotateY(0); } to { transform: rotateX(360deg) rotateY(360deg); } }
Javascript:
document.addEventListener(“DOMContentLoaded”, () => {
const dotPositions = [
[[50,50]],
[[30,30], [70,70]],
[[30,30], [50,50], [70,70]],
[[30,30], [70,30], [30,70], [70,70]],
[[30,30], [70,30], [50,50], [30,70], [70,70]],
[[30,25], [70,25], [30,50], [70,50], [30,75], [70,75]]
];
const container = document.getElementById(“dice-container”);
const answerEl = document.getElementById(“answer”);
function createDiceSVG(dots) {
let dotElements = dots.map(([cx, cy]) => `<circle cx=”${cx}” cy=”${cy}” r=”7″ fill=”black”/>`).join(”);
return `<svg viewBox=”0 0 100 100″>
<rect width=”100″ height=”100″ rx=”15″ fill=”white” stroke=”black” stroke-width=”5″/>
${dotElements}
</svg>`;
}
function rollDice() {
const d1 = Math.floor(Math.random() * 6);
const d2 = Math.floor(Math.random() * 6);
container.innerHTML = createDiceSVG(dotPositions[d1]) + createDiceSVG(dotPositions[d2]);
answerEl.textContent = answers[Math.floor(Math.random() * answers.length)];
container.querySelectorAll(“svg”).forEach(svg => {
svg.classList.add(“rolling”);
setTimeout(() => svg.classList.remove(“rolling”), 1000);
});
}
document.getElementById(“rollButton”).addEventListener(“click”, rollDice);
});