From: Jacob Fugal Date: 2005-07-16T04:54:52+09:00 Subject: Re: [QUIZ] Sampling (#39) On 7/15/05, Cassio Pennachin wrote: > > Shouldn't those number be more like > > > > 999999xxx > > As far as I know, they just have to be between 0 and LIMIT-1. In > fact, if the tail end of the sample is heavily concentrated as you > suggest, it's probably a badly biased sample. Unfortunately, my > sampler is biased as well, just not in this particular way. > > It's not hard to remove the bias, but then the script would be 50-60% > slower, which makes it significantly less useful for taunting others > ;-). Probability of a random sample X from population (0...1_000_000_000) being less than or equal to 462_470_382 is 0.462470382. Probability of ALL 5_000_000 random samples from same population being less than or equal to 462_470_382 is (0.462470382 ^ 5_000_000) < 1.0e-1_674_580. Those are VERY slim chances. Additionally, that figure assumes repeats are allowed. Since they're not, after each sample below 462_470_382, it will be even LESS likely that the next sample will also be below 462_470_382 since there are fewer low numbers to choose from. I wouldn't be surprised if the actual chance were less than 1.0e-2_000_000. It IS possible, but not likely. Now on the other hand, the probability of the last number being >= 999_999_000 is the probability of ANY being >= 999_999_000 which is exactly the same as the negation of the probability that ALL are < 999_999_000. Using the same procedure as above, that probability is (0.999999 ^ 5_000_000) == 0.006738. So the probability of ANY of the samples being at least 999_999_000 is (1.0 - 0.006738) = 0.993262, or 99.3262%. Pretty good chances. Jacob Fugal