Need to randomly select M records (means each record in the file have the same probability to choose) from a file with N records (N > M). Wondering if any solution which read file only once?
The only method I think about is select each record with probability M/N, but this way could result in either less than M or more than M records.
Any smarter ideas are appreciated.
regards, Lin
Aucun commentaire:
Enregistrer un commentaire