[Numpy-discussion] match RNG numbers with R?
Daπid
davidmenhur at gmail.com
Mon Apr 7 10:16:30 EDT 2014
On Apr 7, 2014 3:59 AM, "Yaroslav Halchenko" <lists at 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.
As a side note, C++11 includes in the standard a MT RNG guaranteed to be
the same across implementations, but there is no promise about the
distributions -not even across versions of the same implementation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140407/63fa121d/attachment.html>
More information about the NumPy-Discussion
mailing list