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 vstinner
Recipients mark.dickinson, rhettinger, serhiy.storchaka, veky, vstinner
Date 2020-04-15.13:35:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586957740.61.0.313448294771.issue40286@roundup.psfhosted.org>
In-reply-to
Content
The performance of the new method is not my first motivation.

My first motivation is to avoid consumers of the random to write a wrong implementation which would be biased. It's too easy to write biased functions without notifying.

Moreover, it seems like we can do something to get reproducible behavior on different architectures (different endianness) which would also be a nice feature.

For example, in bpo-13396, Amaury found this two functions in the wild:

* struct.pack("Q", random.getrandbits(64))
* sha1(str(random.getrandbits(8*20))).digest()

As I wrote, users are creative to workaround missing features :-) I don't think that these two implementations give the same result on big and little endian.
History
Date User Action Args
2020-04-15 13:35:40vstinnersetrecipients: + vstinner, rhettinger, mark.dickinson, serhiy.storchaka, veky
2020-04-15 13:35:40vstinnersetmessageid: <1586957740.61.0.313448294771.issue40286@roundup.psfhosted.org>
2020-04-15 13:35:40vstinnerlinkissue40286 messages
2020-04-15 13:35:40vstinnercreate