From: Joost Diepenmaat Date: 2005-07-17T05:23:09+09:00 Subject: Re: [QUIZ] Sampling (#39) On Sun, Jul 17, 2005 at 05:01:02AM +0900, Bill Kelly wrote: > From: "Olaf Klischat" > > > > See? One number per 200-numbers interval. Every time[1]. This hints at > > a wrong implementation. > > I used the same approach. I wasn't sure if it was legal > or not. But it was sure easy... :) I'm sure it was :-) I'm now down to 1.24 seconds without "cheating": time ./sample2 5_000_000 1_000_000_000 >big.txt real 1m24.165s user 1m17.554s sys 0m5.252s head big.txt 30 64 65 760 1136 1418 1536 1796 2190 2306 tail big.txt 999998474 999998602 999998676 999998802 999998909 999999036 999999048 999999080 999999196 999999467 wc -l big.txt 5000000 big.txt But I'm pretty much out of ideas on how to make it faster. Joost.