How do you test a randomized algorithm?
Running it a million times might not be enough.
I wrote about a few testing strategies, culminating in a neat trick: enumerate every possible execution trace and check correctness exactly.
timvieira.github.io/testing-random…
Conditional Poisson Sampling (CPS)
CPS is a distribution over fixed-size subsets in which each subset’s probability is proportional to the product of its items’ weights.
This one has lots of fun JavaScript and math.
timvieira.github.io/conditional-po…