Negative Binomial Simulator
How many attempts does it take to get three successes when each attempt works thirty percent of the time? The mean is refreshingly simple — successes divided by probability, so ten — but the distribution has a long right tail, and planning to the average will under-provision badly. This runs it thousands of times so the range is visible next to the mean, which is the number people actually need.
What this generator does
Repeats independent attempts until the target number of successes is reached, over many runs. It reports the observed mean and range next to the exact expectation of successes divided by the success probability.
How to use this tool
- Set how many successes you want and the chance of each attempt.
- Predict the mean number of attempts.
- Run it, and compare against the exact expectation.
- Look at the maximum: it is usually far above the mean.
Understanding the controls
- Successes wanted
- From 1 to 20. One success is the geometric distribution; more is the negative binomial.
- Chance of success (%)
- How likely each independent attempt is to succeed.
- How many runs
- From 100 upwards, capped at 5,000 — enough for the mean to settle while the tail stays visible.
- Seed
- Reproduces exactly the same sequence of attempts.
Common use cases
- Estimating attempts needed for a target number of successes
- Showing why planning to an average under-provisions
- Teaching the geometric and negative binomial distributions
- Retry-budget estimates in an abstract setting
- Repeating an identical set of attempts from a seed
How this generator works
Each run counts trials until the required successes accumulate. The check confirms no run reached its successes in fewer trials than there are successes, that the theoretical mean is exactly successes over probability, and that the observed mean sits within four standard errors of it.
Randomness and fairness
Each trial's outcome is random; the expectation is exact arithmetic. Seeded runs reproduce and are therefore explicitly not cryptographically secure, and unseeded ones use the browser's cryptographically secure generator.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- Trials are independent and identically likely, which real retries with backoff are not.
- Success chances below five percent are not offered, since the runs get very long.
- The spread is given as a mean and a range rather than a histogram.
- Each run is capped at 100,000 trials as a safety bound.
- Trial runs are not retained; seed them to compare two success rates fairly.
Privacy and your data
Trials are simulated in your browser. Nothing about your settings or results leaves the page.
Related generators
- Coupon Collector SimulatorHow many random draws it takes to collect a full set, against the exact harmonic-number expectation.
- Gambler's Ruin SimulatorA bounded random walk between zero and a target, with the exact ruin probability alongside the observed one.
- Binomial Experiment SimulatorRepeat a fixed run of trials thousands of times and watch the count of successes form its distribution, with theory shown beside it.
- Poisson Process SimulatorSimulate counts of independent events per interval and see why a Poisson process cannot have a tidy, narrow spread.