random k-sample of a file

Walter Bright newshound1 at digitalmars.com
Thu Oct 9 16:29:10 PDT 2008


Andrei Alexandrescu wrote:
> No go if the file is a stream. Can it be done in one pass?

No, because without knowing the number of lines, you cannot produce a 
uniform distribution.

Unless you're willing to make a guess based on the file size.



More information about the Digitalmars-d mailing list