
In concept, what James suggests, is similar to the Random123 library, written at D.E.Shaw Research by my sadly late colleague John Salmon. See https://github.com/DEShawResearch/random123 and the linked academic publications. E.g. https://dl.acm.org/doi/10.1145/2063384.2063405 In general, all PRNGs are deterministic, and by relying on a known seed, the Nth element in a sequence of random numbers can always be reconstructructed. However, if a large number of random numbers are used, certain replication scenarios make the purely sequential nature of generators like Mersenne Twister or linear congruential generators inconvenient. Counter based pseudo-random generators like Random123 use cryptographic transformations upon counter variables, and were rigorously shown to pass all standard tests of randomness of distribution. However, these tests were done using AES, Threefish, and Philox, and do not automatically apply to SHA256 that James uses. The advantage of these is that they allow direct construction of the Nth element in a pseudo-random sequence without large memory or CPU usage needed to construct the N-1 prior elements. That said, Random123 is *done right* by a number of very brilliant people who performed rigorous testing. Something that "seems kinda similar" may or may not be of similar quality (more likely not). FWIW, AES is built-in as a primitive instructruction on most modern general-purpose CPUs, so can be very fast to perform. On Mon, Nov 14, 2022 at 10:56 AM Barry <barry@barrys-emacs.org> wrote:
On 14 Nov 2022, at 14:31, James Johnson <jj126979@gmail.com> wrote:
I wrote the attached python (3) code to improve on existing prng functions. I used the time module for one method, which resulted in disproportionate odd values, but agreeable means.
I used the hashlib module for the second. It is evident that the code is amateur, but the program might result in better PRN generation.
The "app" lends itself to checking, using statistical tools (see comments.)
Have you used any cryptographic tools to prove the quality of your PRNG? What results did you get? How does your PRNG compare to what python already has?
Without that this analysis this will be unlikely to be considered as a candidate for python stdlib.
Barry
I remain a fan,
James Johnson <testrandom.py> _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/VENAT2...
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/HWQV4A... Code of Conduct: http://python.org/psf/codeofconduct/
-- Keeping medicines from the bloodstreams of the sick; food from the bellies of the hungry; books from the hands of the uneducated; technology from the underdeveloped; and putting advocates of freedom in prisons. Intellectual property is to the 21st century what the slave trade was to the 16th.