I asked the same question in the post: A special random subset of uniformly distributed numbers is still uniformly distributed?
Let me describe my question again. Assume that I have a value range [1,1000].
Goal: I want to have 10 numbers randomly sampled from [1,1000].
I sample 20 numbers, a1, ..., a20 from [1,1000]. Then I sample b1, ..., b10 from [a1, a2, ..., a20]. b1, ..., b10 are what I want.
I partition [1,1000] into 10 intervals, I1=[1,100], I2=[101,200], ... I10=[901,1000]. Then I sample one number bi from Ii. Eventually I still have 10 numbers b1, ..., b10.
Everyone said that the numbers in case2 are not uniformly distributed.
I also agree with that.
However, I used MATLAB to generate case1 and case2, and then I ran 2-sample kolmogorov smirnov test on case1 and case2.
Eventually, kolmogorov smirnov test told me that they are the same!! (always accept null hypothesis)
Can anyone explain this phenomenon?
My code is as follows for the reference.
clear all; n=1000; case1=randsample(n,10); case1=sort(case1); case2=; for in=1:10 case2=[case2 randi( [((in-1)*100)+1 in*100] ,1,1 ) ]; end kstest2(case1,case2)