Expected defects found versus number of test runs.
If each test run independently triggers a given defect with probability p, then after n runs it is found with probability 1-(1-p)n. For B identical defects the expected number found is B[1-(1-p)n], an exponential approach to B.
Real defects are heterogeneous. With a share f of hard defects (small ph), the expected curve is the mixture B[(1-f)(1-(1-pe)n) + f(1-(1-ph)n)]. It rises fast, then crawls: the long tail is why "all tests pass" never proves absence of bugs and why targeted strategies (boundary values, risk-based tests) matter.
Tests are treated as independent and identically effective. Real test suites are correlated and adaptive, so this curve is an optimistic baseline.
A Monte Carlo of individual bugs and test runs reproduces the mixture formula; the final count must agree within four standard errors. The result is shown live under the chart and turns red if the agreement fails.
All random draws come from a seeded 32-bit generator (mulberry32) and Gaussian variates from the Box-Muller transform, so a given seed always produces the same sample on every device; Re-run random seed advances the seed deterministically. Deterministic curves are evaluated on a fixed grid and integrated, where needed, with a fixed-step fourth-order Runge-Kutta scheme whose local error scales with the fifth power of the step; the step sizes used here keep the error far below the drawn line width.
The tiles under the chart are recomputed on every slider move. Quantities labelled exact or analytic come from a closed-form expression; quantities labelled simulated come from the random sample and fluctuate around the exact value by an amount that shrinks as the sample size grows (roughly as one over the square root of the sample size). The green or red box is the automated agreement test between the two.
This page is an educational model, not a decision tool. It is meant to build intuition for how a handful of parameters shape an outcome and how a stated formula can be checked against an independent numerical experiment. Numbers are illustrative unless a unit is given, and results must not be used for real engineering, medical, financial or legal decisions. If you notice a result that contradicts the stated formula, the built-in check is the first place to look: it is designed to fail loudly instead of hiding a disagreement, and a failing check on a sensible parameter set would be a bug worth reporting.
Why does the simulated value never match the exact one perfectly? Because a finite random sample has sampling error; the check box tests that the difference is no larger than four standard errors, which a correct model fails only about once in sixteen thousand runs.
Why are some sliders limited to a narrow range? Outside those ranges the formula is still valid mathematically but the plain-language interpretation stops making sense, or the chart would become unreadable.
Can I embed or share a state? The page keeps no hidden state: the sliders, the seed and the formulas fully determine every number you see, so a screenshot of the sliders is enough to reproduce a result.
Does the chart work on a phone? Yes. The canvas resizes with its container, scales to the device pixel ratio (capped at 2 for smooth drawing), and the controls stack above the chart on narrow screens.