[Tutor] reading random line from a file
Tiger12506
keridee at jayco.net
Thu Jul 19 23:53:54 CEST 2007
> I think the best strategy for this problem would be to build an index of
> the offset of the start of each line, and then randomly select from this
> list.
> that makes each line equally probable, and you can set up your class so
> that the index is only built on the first call to the function.
> -Luke
Oh fudge! I knew there was a "best-way-to-do-it". Now I'm upset cuz i didn't
think of it first. ;-)
JS
More information about the Tutor
mailing list