Random Lines from a File
Update 2011-07-18: As Ernesto correctly points out in the comments, this algorithm selects N independent random lines from a file.
The following is my python implementation of choosing N random lines with equal probability from a file. This implementation is both memory and time efficient unlike other solutions. This problem …
more ...