Code to go along with the Random Algorithms blog.