Interactive module guide
LLN & CLT Sample Mean Simulator Guide
Free · No sign-up · Calculations stay in your browser
This simulator demonstrates the two pillars of large-sample statistics with actual random draws.
The Law of Large Numbers view tracks a running sample mean as observations accumulate and shows it settling toward the population mean μ.
The Central Limit Theorem view repeats many samples of a fixed size n, collects their means, and shows the histogram of those means taking a normal shape centered at μ with spread σ/√n—whatever the base distribution looks like.
A seed control makes every run reproducible, so a classroom can replay the identical simulation.
Is this the right module for my question?
Use it when
- Use the LLN view to give "the average settles down" a concrete picture: one path of the running mean, wobbling hard at small n and stabilizing near μ, is worth more than the formal statement to most learners.
- Use the CLT view to separate two objects students routinely conflate: the distribution of the data (which stays skewed, flat, or binary) and the distribution of the sample mean (which becomes approximately normal as n grows).
- Use the base-distribution menu to stress-test intuition: starting from the skewed exponential or the two-point Bernoulli makes the emergence of the bell shape genuinely surprising in a way the normal base cannot.
Choose another method when
- Avoid treating any single simulated path as evidence: one running mean that wanders late is not a counterexample to the LLN, and one lumpy histogram at small repetitions is not a CLT failure—rerun with another seed before concluding anything.
- Avoid extrapolating to distributions without finite variance: every base offered here has finite moments; heavy-tailed cases where the CLT genuinely fails are outside this simulator’s current menu.
- Avoid reading σ/√n as a statement about one sample’s accuracy: it is the spread across hypothetical repeated samples, which is precisely what the CLT view visualizes.
Interactive tool
The calculator loads as you approach this section so the guide remains fast on mobile connections.
Example preview
Skewed means turning normal
- Inputs
- Exponential(rate 1) base, n=40, several hundred repeated samples.
- Representative result
- The histogram of sample means centers near 1 with spread ≈ 1/√40 ≈ 0.158 and closely follows the overlaid normal curve.
Illustrative only. Load the interactive tool to enter your own values and review assumptions.
Watch the explanation
1:51 minThe player loads only after you press play. You can also watch on YouTube.
Read the complete transcript
LLN and CLT for Sample Means. The Law of Large Numbers and Central Limit Theorem describe two different views of sample means.
Start with a right-skewed exponential population whose mean and variance both equal one. Draw one independent sequence; individual values remain noisy and occasionally large. After each observation, divide the accumulated total by the number seen so far. The path can cross the target and move away again; convergence is not monotone. By two hundred observations, the running mean is usually much closer to the population mean. That is the LLN view: one average stabilizes, while the raw population stays skewed.
Now reset and draw one thousand independent samples, each containing two observations. Compress every pair to one mean, producing one thousand sample means. With sample size two, their distribution remains visibly right-skewed.
Increase each sample to thirty observations and repeat the same averaging operation. The means remain centered near one, even though the original observations were skewed. Their theoretical standard error is sigma over square root n, here one over square root thirty, about zero point one eight three.
Standardize each mean by subtracting one and dividing by that theoretical standard error. The standardized histogram now follows the standard normal reference much more closely. The CLT needs independent, identically distributed sampling and finite variance; larger n does not repair bias or dependence. Use LLN for one accumulating average, and CLT for the distribution of averages across repeated samples.
Try both simulations free at Distri Scope dot com.
How to read the result
In the LLN view, expect the early path to be visibly wild: convergence at rate roughly 1/√n means the first dozen observations carry most of the wobble.
In the CLT view, watch the horizontal axis shrink as n grows—the σ/√n scaling is often the most practically important part of the theorem, since it quantifies how much averaging buys.
The Bernoulli base is the bridge to proportions: sample means of 0/1 data are sample proportions, so the emerging bell explains why proportion inference uses normal machinery.
Inputs and parameter meaning
Choose a base distribution (standard normal, exponential with rate 1, uniform on (0, 1), or Bernoulli with p = 0.3), the sample size n, and—in the CLT view—the number of repeated samples.
The seed field fixes the pseudorandom stream: the same seed, settings, and view reproduce the identical picture, which makes results shareable and debuggable.
The two views answer different questions—one path growing in n (LLN) versus many samples at fixed n (CLT)—so switch deliberately rather than comparing them side by side.
Limit, parameter, and conditions
Interactive parameter: Base distribution, sample size n, and number of repetitions.
- Observations are independent draws from one base distribution with finite variance.
- The LLN view tracks a running mean; the CLT view repeats fixed-size samples.
- Convergence statements concern limits in n; finite-sample displays are illustrations.
What the method is doing
Draws use a seeded Mulberry32 pseudorandom generator with standard transformations (Box–Muller for the normal, inverse CDF for the exponential), so results are reproducible rather than cryptographically random.
The CLT view overlays the theoretical Normal(μ, σ²/n) density on the histogram of simulated means, using the exact μ and σ of the chosen base distribution—no fitted parameters.
Displayed summary numbers (mean of means, standard deviation of means) are computed from the simulated values, so they should hover near μ and σ/√n without matching exactly.
Worked example: exponential base, n = 40
Choose the exponential base distribution (rate 1, so μ = 1 and σ = 1), set the sample size to n = 40, and simulate several hundred repeated samples in the CLT view with a fixed seed. The base distribution is strongly right-skewed, with its mode at zero.
- 1Inspect the base: exponential data pile up near zero and stretch far right—individual observations look nothing like a bell.
- 2Run the simulation: the histogram of the several hundred sample means centers near μ = 1.
- 3Compare the spread with theory: the standard deviation of the simulated means should sit near σ/√n = 1/√40 ≈ 0.158.
- 4Overlay check: the Normal(1, 1/40) curve tracks the histogram closely, with only a mild remnant of right skew—the CLT at work on a decidedly non-normal base at a moderate n.
Interpretation
Averaging forty skewed observations produces a nearly normal sample mean with spread about six times smaller than the raw data. That is the practical content of the CLT: it licenses normal-based inference for means of non-normal data at moderate sample sizes, while the visible remnant of skew is an honest reminder that the approximation is asymptotic, not exact.
Common mistakes
- Do not conclude that the data become normal: only the sample mean does; the base histogram would remain skewed at any n.
- Do not treat the simulator’s stabilization point as a universal cutoff: how fast the bell emerges depends on the base distribution’s skewness—Bernoulli with small p needs a much larger n than the uniform.
- Do not confuse reproducibility with generality: a fixed seed replays one realization; conclusions should survive seed changes.
Limits and independent validation
All base distributions offered have finite variance, so the simulator cannot yet display CLT failure for heavy-tailed populations—a planned extension.
Finite repetitions produce sampling noise in the histogram itself; small repetition counts can look ragged for reasons unrelated to the theorem.
The simulator illustrates convergence; it does not prove rates or provide finite-sample error bounds such as Berry–Esseen.
Before using the result
- Fix a seed and rerun: the identical picture should reappear, confirming the reproducibility contract.
- Check the two theoretical anchors against the displayed summaries: the mean of means near μ and the standard deviation of means near σ/√n.
- Double n and confirm the histogram’s width shrinks by about √2—the scaling law is the most testable prediction on the page.
Related modules and resources
Explore Other Convergence Visualizations
See every option in the Distribution Convergence Explorer or review the DistriScope methodology. Educational information; last reviewed 2026-08-09. Verify consequential calculations independently.