What's the best way to return a random line in a text file using C?
- by jeremy Ruten
What's the best way to return a random line in a text file using C? It has to use the standard I/O library (<stdio.h>) because it's for Nintendo DS homebrew.
Clarifications:
Using a header in the file to store the number of lines won't work for what I want to do.
I want it to be as random as possible (the best being if each line has an equal probability of being chosen as every other line.)
The file will never change while the program is being run. (It's the DS, so no multi-tasking.)