HomeComputer ScienceCoupon Collector: Feature Flag Coverage Lab

Coupon Collector: Feature Flag Coverage Lab

Interactive 2D coupon-collector simulator: watch random feature-flag tests cover a 2^N state space and see the live coverage curve track the exact analytic expectation n·(1-(1-1/n)^t), plus the expected number of tests to reach full coverage, n·H_n.

Computer Science2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-mobile-feature-flags ↗ Open standalone

Every boolean feature flag an app carries multiplies the number of distinct configurations a user could actually be running by two, so N flags produce a state space of n = 2^N combinations. Testing those combinations by picking one at random each time is mathematically identical to the classical coupon collector's problem, and it has an exact closed-form prediction: after t independent random tests, the expected number of distinct states covered is n·(1 − (1 − 1/n)^t), and the expected number of tests needed to cover every single state is n·H_n (n times the n-th harmonic number). This simulator runs the random test process live — lighting up cells in a 2^N state grid as they get hit — while a second panel plots that live coverage curve directly against the closed-form prediction, so you can see the theory and the Monte-Carlo simulation agree in real time. Drag the flag count up and watch the curve's characteristic decelerating shape: the first half of the state space fills quickly, but the last handful of "dark corner" combinations take disproportionately many additional tests to ever get exercised — the precise reason real flag-management platforms push teams toward targeted pairwise testing instead of hoping random test runs eventually find every corner.

⚙ Under the hood

Interactive 2D coupon-collector simulator: random feature-flag tests light up cells in a 2^N state grid while a live coverage curve is plotted directly against the exact analytic prediction n*(1-(1-1/n)^t), alongside the expected number of tests to reach full coverage, n*H_n.

feature flagscoupon collector problemcombinatoricssoftware testingstate spaceprobability

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)