random k-sample of a file

Walter Bright newshound1 at digitalmars.com
Thu Oct 9 16:51:02 PDT 2008


Andrei Alexandrescu wrote:
> Walter Bright wrote:
>> 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.
> 
> I am getting revenge for "I never use anything in std.algorithm" :o).

Get in line for everyone getting their revenge on me!



More information about the Digitalmars-d mailing list