This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jfbu
Recipients jfbu, mark.dickinson, rhettinger, tim.peters
Date 2020-03-06.07:23:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583479425.14.0.120087578316.issue39867@roundup.psfhosted.org>
In-reply-to
Content
"bug" is a strong word, which I did never employ myself, apart from using this channel of report. I rather think of a (non-documented) "deficiency", but I expect the consensus will again be that I am expressing a "raw expression". However reading more than once that "the correlations are indeed unsurprising" it is my turn to see there a raw expression. The correlations are unsurprising *only* if one looks at the source code and understand how a (to a very high degree) uniform distribution on a power of 2 range is reduced to distribution on the smaller range (keeping the extremely high uniformity). Thus, sorry, the correlations are to the contrary *very surprising* to the end user who has no knowledge of the internals.

Donald Knuth for example many decades ago in his work on MetaPost used a RNG which is a kind a primitive ancestor (in the family of those commented upon in AOCP) of the much more sophisticated one used nowadays by Python. He used the rescaling with rounding method to go from power of 2 range to non power of 2 range. That method induces some non-uniformity and if I understand (without having checked) it was the one from Python < 3.2. At some point Python changed its way to another way, to cure non-uniformity (and other artefacts of the simple minded rescaling method). But there are other ways to reduce the non-uniformity to negligible levels which are not the choice made currently in Python code. (which for people not having _randbelow_with_getrandbits before their eyes is simply to draw a random integer with at most the number of bits of the limit N until one is found at most equal to N).
History
Date User Action Args
2020-03-06 07:23:45jfbusetrecipients: + jfbu, tim.peters, rhettinger, mark.dickinson
2020-03-06 07:23:45jfbusetmessageid: <1583479425.14.0.120087578316.issue39867@roundup.psfhosted.org>
2020-03-06 07:23:45jfbulinkissue39867 messages
2020-03-06 07:23:44jfbucreate