Russell Lewis wrote:
> BEGIN CODE
> char[][] choose(int k)
> {
> char[][] bufs; bufs.length = k;
>
> for(int i=0; i<k; i++)
> bufs[i] = ReadALine();
>
> while(!feof(stdin))
> {
> int i = random(0,k);
> bufs[i] = ReadALine();
> }
>
> return bufs;
> }
>
> END CODE
Then the last line will be part of the selection with probability 1.
Andrei