On Mon, Apr 7, 2014 at 3:16 PM, Daπid <davidmen...@gmail.com> wrote: > > On Apr 7, 2014 3:59 AM, "Yaroslav Halchenko" <li...@onerussian.com> wrote: >> so I would assume that the devil is indeed in R post-processing and would >> look >> into it (if/when get a chance). > > The devil here is the pigeon and the holes problem. Mersenne Twister > generates random integers in a certain range. The output is guaranteed to be > deterministic, uniform, and reproducible. > > But when you want to cast those m possible input in n possible outputs, you > need to do magic (or maths) to keep the new distribution truly uniform. > Simply getting random bytes and viewing them as ints will give you low > quality random numbers. > > The algorithm that casts MT output to a random integer is probably what is > different, and perhaps you could find it documented somewhere.
This is ours: https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/randomkit.c#L259 -- Robert Kern _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion