I wasn't really worried whether it was the best way or not, nor whether it used modules or not. I was just amused by the technique for getting a single random line from a file with equal probability, and wanted to generalize it so I could use it for multiple lines.
Unfortunately, I haven't come up with any ideas that don't introduce a bias. (I haven't thought about it really hard for the last few days, but I've given it occasional thought during my daily commutes.)
I might be able to come up with something if I would sit down and analyze the probabilities, but it's not quite interesting enough to work *that* hard on it! ;^)
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re^5: Get random unique lines from file
by roboticus
in thread Get random unique lines from file
by radnorr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |