Here’s a small puzzle:
There’s a file with an unknown number of lines. From that file, I want to read and display 1 line. The line needs to be picked completely at random, so that every line has an equal chance to be selected.
What’s the fastest algorithm you can come up with?
Recent Comments