A question for the statisticians and mathematicians among us. Suppose I want to generate uniform random numbers ?n$q. Is it valid to generate ?m$p where p>q, and keep only the numbers which are less than p? Assume that m can be as large as we like.
An example where p is 30 and q is 10. x=: ?1e6$30 y=: (x<10)#x n=: #y n 332824 c=: <: #/.~(i.10),y +/c 332824 Here, c are the count of the numbers 0,1,2,...,9 in y. The maximum absolute difference between the sample cumulative distribution n%~+/\c and the the theoretical cumulative distribution +/\10$0.1 is: >./ | (n%~+/\c) - +/\10$0.1 0.000795616 The ⍺=0.01 critical value for the Kolmogorov test <https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test> is approximately 1.63 % %: n 0.0028254 Therefore, for this one test, y is uniformly distributed with confidence > 1-⍺=0.99, like ?n⍴10. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
