Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
FWIW, I paid close attention to rounding. The reason for the "while small and large" is that the loop stops making aliases unless we have both something at or below 0.5 and something known to be above 0.5. If we end up with only two bins slightly above over below 0.5, they are considered close-enough and will alias to themselves. By giving the bins a default alias to themselves, there is always a reasonable dispatch in the main sampling loop even if the random() value compares to an unfavorably rounded entry in U. The code assumes that weird roundings will happen through out. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41131> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com