From: Olaf Klischat Date: 2005-07-16T22:10:53+09:00 Subject: Re: [QUIZ] Sampling (#39) Ezra Zygmuntowicz writes: > On Jul 15, 2005, at 6:10 AM, James Edward Gray II wrote: >>> >> >> P.S. Taunting each other with fast time readouts is not a >> spoiler. Feel free! ;) >> >> James Edward Gray II >> >> > ezra:~/Sites ez$ time ./sample.rb 5_000_000 1_000_000_000 > > big_sample.txt > > real 0m43.838s > user 0m35.820s > sys 0m1.360s > ezra:~/Sites ez$ ls -l big_sample.txt > -rw-r--r-- 1 ez ez 49444445 Jul 15 10:46 big_sample.txt > ezra:~/Sites ez$ head big_sample.txt > 168 > 285 > 566 > 604 > 912 > 1183 > 1335 > 1473 > 1728 > 1919 > ezra:~/Sites ez$ tail big_sample.txt > 999998155 > 999998313 > 999998484 > 999998680 > 999998825 > 999999151 > 999999330 > 999999465 > 999999621 > 999999877 > ezra:~/Sites ez$ Umm... I'm not sure, but that looks a bit too "equidistant" to be truly random, doesn't it? The sample being truly random means that the sample should be a truly "drawing without putting back" (e.g. lottery) sample, so each possible sample occurs with equal probability. So a sample like 0 1 2 .. .. .. 4999999 should occur with the same probability as any other more "likely" one. That rules out certain more "obvious" (non-)implementations.