Sample from a bell curve on demand
While most random tools give you uniform numbers, real-world quantities like measurement noise, heights, or returns tend to follow a normal (Gaussian) distribution. This generator produces values clustered around a mean you choose, with a spread set by the standard deviation — perfect for simulations, statistics lessons, and generating realistic-looking test data.
How it works
Uniform random numbers cannot be reshaped into a bell curve by simple scaling, so the tool uses the classic Box-Muller transform. It draws two independent uniform values U1 and U2 in the range (0, 1) and computes a standard normal value:
z = sqrt(-2 * ln(U1)) * cos(2 * pi * U2)
This z has mean 0 and standard deviation 1. Each sample is then shifted and scaled to your parameters with x = mean + stdDev * z. After generating the requested count of samples, the tool reports the sample mean, the sample standard deviation (using the unbiased n − 1 divisor), and the minimum and maximum so you can confirm the output matches the distribution you asked for.
Setting mean and standard deviation for common use cases
The two parameters define the shape of the distribution entirely. Here are typical values for common scenarios:
Test score simulation: Mean 70, standard deviation 10. This gives a realistic spread for a class exam where most students score between 60 and 80, with occasional scores near 40 and 100 at the tails.
Measurement noise: Mean 0, standard deviation matching the instrument precision. For example, a scale accurate to ±5 g might be modelled with mean 0 and standard deviation 2. Add the noise to a true value to simulate a noisy measurement series.
Height distribution (illustrative example): A generator set to mean 170 and standard deviation 10 (in centimetres) will produce a spread broadly similar to adult human heights in many populations, useful for populating a demo dataset with realistic-looking values.
Financial return simulation: Mean slightly above 0 (for a long-run upward drift), standard deviation set to reflect volatility. This is the basis of simple Monte Carlo simulations for portfolio risk. Note that real financial returns are not perfectly Gaussian — they have fat tails — so this is illustrative, not a production model.
Reading the sample statistics
After generating a batch, the tool shows four summary values:
| Statistic | What it tells you |
|---|---|
| Sample mean | Should be close to your chosen mean; wanders more with small samples |
| Sample standard deviation | Should be close to your chosen σ; uses the unbiased n−1 formula |
| Minimum | The lowest value drawn — expect roughly mean − 3σ at large sample sizes |
| Maximum | The highest value drawn — expect roughly mean + 3σ at large sample sizes |
The 68-95-99.7 rule is a quick sanity check: about 68 % of samples should fall within one standard deviation of the mean, around 95 % within two, and nearly all within three. If you generate 200 samples and almost all of them land well outside two standard deviations of your mean, something is wrong with your inputs.
Tips and notes
Generate a large sample, such as several hundred values, to see the sample mean and standard deviation closely match your inputs — small samples will wander more. These numbers rely on Math.random() and are suitable for modelling, testing, and statistics teaching, but not for cryptographic use or security-sensitive applications.