# Central Limit Theorem Demonstrator

See the Central Limit Theorem in action: draw samples from a non-normal source distribution (uniform, exponential, Poisson, or Bernoulli), plot the histogram of sample means, and overlay the predicted Normal curve N(μ, σ²/n). Compare empirical vs theoretical mean and standard error, and watch convergence tighten as the sample size grows.

> Canonical page: https://elysiatools.com/en/tools/central-limit-theorem-demonstrator

- **Category:** Data Visualization

- **Keywords:** central limit theorem, clt, sampling distribution, normal distribution, gaussian, statistics, probability, sample mean, standard error, monte carlo, histogram, data science, teaching, ap statistics

## Overview

An interactive statistics teaching tool for intro stats / data-science students, A/B-test instructors and AP Statistics teachers:

1. **Source distribution** — pick a clearly non-normal population: Uniform(0,1), Exponential(λ=1), Poisson(λ=4), or Bernoulli(p=0.3).
2. **Sample size n** — how many draws go into each sample mean. Raise it to watch the sampling distribution narrow (spread ∝ σ/√n) and bell out.
3. **Number of samples** — how many sample means to generate (the histogram resolution).
4. **Output** — a histogram of the sample means with the theoretical Normal curve overlaid, plus empirical vs theoretical mean and standard error, and a rug plot of the raw source data.

Uses a seeded PRNG (mulberry32) so every run with the same inputs is reproducible — great for classroom demos where everyone should see the same picture.

## Inputs

- **Source distribution** (select)
- **Sample size (n)** (number): Draws per sample mean. Larger n → narrower, more normal sampling distribution.
- **Number of samples** (number): How many sample means to generate (histogram resolution).
- **Number of bins** (number): 40
- **Random seed** (number): Same seed → identical results (reproducible demos).
- **Decimal places** (number): 3

## When to use

- When teaching or studying introductory statistics, probability theory, or data science concepts.
- When demonstrating how sample size (n) affects the shape and spread of a sampling distribution.
- When verifying empirical sample means and standard errors against theoretical calculations for non-normal populations.

## How it works

- Select a non-normal source distribution, such as Uniform, Exponential, Poisson, or Bernoulli, to act as the population.
- Set the sample size (n) per mean, the total number of sample repetitions, and the number of histogram bins.
- Enter an optional random seed to ensure the pseudo-random number generator produces reproducible results.
- Generate the interactive HTML output to view the histogram of sample means, the overlaid theoretical Normal curve, and the comparison of empirical versus theoretical metrics.

## Use cases

- Creating reproducible visual aids for AP Statistics or college-level data science lectures.
- Simulating Monte Carlo sampling to understand the behavior of Bernoulli trials in A/B testing.
- Comparing empirical standard error formulas against simulated outcomes to reinforce theoretical proofs.

## Frequently asked questions

### What source distributions can I choose from?

You can select from Uniform (0–1), Exponential (λ=1), Poisson (λ=4), or Bernoulli (p=0.3) distributions.

### How does increasing the sample size (n) affect the output?

A larger sample size narrows the sampling distribution, reducing the standard error and making the histogram shape more closely match the theoretical normal curve.

### Why is there a random seed option?

The random seed ensures the pseudo-random number generator produces identical, reproducible samples, which is ideal for classroom demonstrations.

### What metrics are compared in the results?

The tool compares the empirical mean and standard error of your generated samples against the theoretical mean and standard error.

### Can I adjust the resolution of the histogram?

Yes, you can customize both the number of sample repetitions (up to 50,000) and the number of histogram bins (up to 120) to refine the visualization.

## Related tools

- [AI RAG Chunk Quality Scorer](https://elysiatools.com/en/tools/ai-rag-chunk-quality-scorer): Score candidate RAG chunk-splitting schemes for a document across four metrics — coherence (clean sentence/paragraph boundaries), coverage (topic focus / key-term concentration), context overlap health, and chunk-size consistency — then compare up to three schemes side by side and recommend the best. Pure offline heuristics, no model calls.
- [CSV Header Alias Resolver](https://elysiatools.com/en/tools/csv-header-alias-resolver): Map messy CSV headers onto a clean target schema. Paste a CSV whose first row holds inconsistent column names (Customer ID, user_id, customerId, CUST_ID…) plus your target schema (one column per line) and an optional "alias=target" dictionary. Each source header is resolved through four layered passes — exact, dictionary, normalized (strips case/accents/separators/camelCase), then fuzzy edit-distance — and shown in a mapping table with method and confidence, plus target coverage and an optional normalized CSV export.
- [ECharts Theme Token Extractor](https://elysiatools.com/en/tools/echarts-theme-token-extractor): Extract design tokens — colors, numbers, font sizes and strings — from an ECharts theme JSON and export them straight into your design system. Paste a theme object (the kind registered via echarts.init(dom, themeName)) and the tool walks every leaf, tagging each color (with optional named/rgb → hex normalization), spacing number, font size and string, then emits clean CSS variables, a Tailwind theme.extend config, Style Dictionary tokens.json, or SCSS variables. Bridges the gap between an ECharts visualization theme and Figma/CSS/Tailwind design tokens without copying each value by hand.
- [Email Signature HTML Builder](https://elysiatools.com/en/tools/email-signature-html-builder): Generate a clean, copy-paste HTML email signature that renders correctly in Gmail, Outlook, and Apple Mail — with avatar/logo, social icons (auto-detected from your links), accent color, light/dark/auto theme, and a table-based email-safe layout using inline styles. Copy the raw HTML and paste straight into your mail client.
- [Image Palette to Design Tokens](https://elysiatools.com/en/tools/image-to-design-tokens): Extract a dominant color palette from an image (k-means clustering), then export it as CSS variables, SCSS variables, a Tailwind config, or JSON design tokens — with named colors and an auto-generated shade scale for each
- [Kepler Orbit Solver](https://elysiatools.com/en/tools/kepler-orbit-solver): Numerically solve Kepler’s equation E − e·sin(E) = M for eccentric anomaly E, true anomaly ν, orbital radius and relative speed, with Newton/bisection/fixed-point methods, convergence history and an SVG orbit diagram
- [Lean Body Mass Calculator (Boer / Hume / James)](https://elysiatools.com/en/tools/lean-body-mass-calculator): Estimate your lean body mass (LBM) from sex, age, weight and height using three clinical formulas side by side, with derived body-fat percentage.
- [Lotka–Volterra Interspecific Competition Simulator](https://elysiatools.com/en/tools/lotka-volterra-competition): RK4 simulation of two competing species with phase plane, isoclines, equilibrium, and automatic outcome classification.

## Samples

- [Web Image Processing Python Samples](https://elysiatools.com/en/samples/web-image-processing-python): Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion
- [Android Image Processing Java Samples](https://elysiatools.com/en/samples/android-image-processing-java): Android Java image processing examples including reading/saving images, scaling, and format conversion
- [Android Image Processing Kotlin Samples](https://elysiatools.com/en/samples/android-image-processing-kotlin): Android Kotlin image processing examples including reading/saving images, scaling, and format conversion
- [Web Image Processing Rust Samples](https://elysiatools.com/en/samples/web-image-processing-rust): Web Rust image processing examples including image read/save, scaling, and format conversion

## Related content

- [Barcode, QR Code, and Label Tools](https://elysiatools.com/en/hubs/barcode-utility): Compare barcode generation, QR code creation and decoding, UPC/EAN validation, WiFi QR sharing, and printable label tools in one hub.
- [Audio Encoding and Format Conversion Tools](https://elysiatools.com/en/hubs/audio-convert): Compare audio format conversion, bitrate changes, sample-rate conversion, codec swaps, and export tools in one hub for delivery and archive workflows.
- [Image Format Conversion and Animated Export Tools](https://elysiatools.com/en/hubs/image-convert): Compare image format converters for JPG, PNG, GIF, AVIF, WebP, TIFF, ICO, base64, and animation-friendly exports in one hub.
- [JSON Interchange and Format Translation Tools](https://elysiatools.com/en/hubs/json-convert): Compare JSON conversion tools for CSV, YAML, TOML, GraphQL, XML, Markdown, Excel, BSON, EDN, and related structured formats in one hub.
