1. read line 1 2. rand(1)<1 #100% chance it's true if we had just one line 3. read line 2 4. rand(2)<1 #50% chance that line 2 replaces line 1 as the random line. 5. read line 3 6. rand(3)<1 #1/3 chance that line 3 replaces the currently chosen line