Floyd's Sampling Algorithm (opens in new tab)
I love sampling algorithms. Here's the sampling algorithm that I find most magical. We want to generate a subset of {1, 2, ..., n} of size k. def floyd(n,...
Read the original articleI love sampling algorithms. Here's the sampling algorithm that I find most magical. We want to generate a subset of {1, 2, ..., n} of size k. def floyd(n,...
Read the original article