in reply to Re^2: selecting N random lines from a file in one pass
in thread selecting N random lines from a file in one pass

(Which does mean the first line can't be picked, but just insert a blank line at the beginning.)
And it also means that if your random seek takes you into the last line of the file, you get the nothing at the end of the file. So, in that case, you could kill both birds by taking the first line of the file - which happens to be very quickly findable. ;-)
  • Comment on Re^3: selecting N random lines from a file in one pass