Run experiments, watch empirical probabilities converge to theoretical values, and explore the Law of Large Numbers in real time.
Coin Flip Experiment
Explore the binomial distribution — each flip has a 50/50 chance. Watch how results converge to 50% as trials increase.
Total Flips
0
Heads
0
Tails
0
Heads %
—
Expected %
50%
Convergence to expected0%
Law of Large Numbers: With a fair coin, each flip is independent and has a 50% chance of heads. While short runs can be wildly uneven, the empirical proportion approaches 50% as the number of trials increases. Try changing the bias to see skewed distributions!
Dice Roll Experiment
Roll dice and watch the uniform distribution emerge. Add multiple dice to see the Central Limit Theorem — sums approach a normal distribution.
Total Rolls
0
Mean
—
Expected Mean
3.5
Std Dev
—
Last Roll
—
Central Limit Theorem: A single die produces a uniform distribution (every face equally likely). But when you add multiple dice, the sum's distribution becomes bell-shaped. This is the Central Limit Theorem in action — the sum of many independent random variables approaches a normal distribution.
Card Draw Experiment
Draw from a standard 52-card deck with or without replacement. See how the probabilities change when the deck isn't reshuffled.
Total Draws
0
Cards Left
52
Last Card
—
Most Common
—
Sampling Without Replacement: When you don't reshuffle, each draw changes the probabilities for future draws. If you draw 3 Hearts in a row, the chance of the next card being Hearts drops from 25% to about 21%. This is fundamental to understanding dependent vs independent events in probability.
Birthday Paradox
With just 23 people in a room, there's a 50% chance two share a birthday. With 70 people, it's over 99%. Run simulations to see this counterintuitive result.
Simulations
0
Matches Found
0
Empirical %
—
Theoretical %
50.7%
Difference
—
Convergence to theoretical0%
Why it works: With N people, there are N(N-1)/2 pairs to compare. For 23 people that's 253 pairs — much more than intuition suggests. Each pair has a 1/365 chance of matching, so the probability of no match is (364/365)^253 ≈ 49.3%, meaning at least one match is 50.7%.
Normal Distribution Sampler
Generate samples from a normal distribution. Watch the bell curve emerge from randomness and explore how mean and standard deviation shape the distribution.
Samples
0
Sample Mean
—
Target Mean
0
Sample Std Dev
—
Target Std Dev
1
The Normal Distribution: The bell curve appears everywhere in nature — heights, test scores, measurement errors, particle velocities. It's defined by just two parameters: the mean (μ) and standard deviation (σ). About 68% of values fall within 1σ, 95% within 2σ, and 99.7% within 3σ of the mean.
About Probability Lab
Why this project?
Probability and statistics are foundational to data science, machine learning, and scientific reasoning — yet most people learn them from static textbook examples. Interactive simulations that let you see the Law of Large Numbers converge and the Central Limit Theorem emerge in real time are far more effective at building intuition than equations alone.
What is it?
Probability Lab is an interactive statistics playground with five experiments:
Coin Flip — Binomial distribution with adjustable bias
Dice Roll — Uniform distribution and the Central Limit Theorem with multiple dice
Card Draw — Dependent vs independent events with/without replacement
Birthday Paradox — Counterintuitive probability simulation
Normal Distribution — Bell curve sampler with configurable mean and standard deviation
Each experiment lets you run trials, see live histograms, and watch empirical probabilities converge to theoretical values.
How does it work?
Each simulation uses the browser's Math.random() for pseudo-random number generation. Coin flips and birthday simulations use direct probability comparison. Dice rolls use integer floor of Math.random() * sides + 1. The normal distribution uses the Box–Muller transform: two uniform random variables are combined via sine and cosine to produce normally distributed samples. Histograms are rendered on HTML Canvas, with theoretical distributions overlaid as reference lines.
How to use it
Select an experiment from the tab bar at the top
Adjust the parameters (coin bias, dice count, etc.) using the controls
Click a trial count button (1, 10, 100, 1,000, etc.) to set batch size
Press Run to execute the trials and update the histogram
Watch the convergence bar to see how close empirical results are to theoretical values
Press Reset to clear all data and start fresh
Compare the stat boxes to understand mean, standard deviation, and expected values