[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Steven D'Aprano
On Tue, Nov 15, 2022 at 12:19:48AM -0600, James Johnson wrote: > The random function in Python is not really adequate for a magic eight ball > program, That is an astonishing claim for you to assert without evidence. Python's PRNG is the Mersenne Twister, which is one of the most heavily studie

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Wes Turner
While FWIU it is advisable to keep seeding an RNG after startup - that's what e.g. rngd does - the cryptography.io docs do advise to just use `os.urandom()` (which is not the same as random.SystemRandom()?). There probably should be better default random in CPython; though I'm personally not at al

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread James Johnson
I want to be good natured about it, not combative. I tried whatever random function I found in documentation online, and used it. Without analyzing the world, I was simply dissatisfied with the results. Here’s what I settled on. I actually “put my thumb on the scales,” to rule out repetitions for

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Chris Angelico
On Tue, 15 Nov 2022 at 21:47, James Johnson wrote: > > I tried whatever random function I found in documentation online, and used > it. Without analyzing the world, I was simply dissatisfied with the results. > Can you explain what you were dissatisfied by? It's worth noting that, for a lot of p

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Chris Angelico
(I'm assuming that you sent this personally by mistake, and am redirecting back to the list. My apologies if you specifically didn't want this to be public.) On Tue, 15 Nov 2022 at 22:34, James Johnson wrote: > > It’s been a couple of years ago, but as I recall the duplicates seemed to be > of t

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Chris Angelico
On Tue, 15 Nov 2022 at 22:41, Chris Angelico wrote: > > (I'm assuming that you sent this personally by mistake, and am > redirecting back to the list. My apologies if you specifically didn't > want this to be public.) > > On Tue, 15 Nov 2022 at 22:34, James Johnson wrote: > > > > It’s been a coup

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Stephen J. Turnbull
James Johnson writes: > I want to be good natured about it, not combative. I tried whatever random > function I found in documentation online, and used it. Without analyzing > the world, I was simply dissatisfied with the results. On the Python lists, you'll get much better discussion if you'r

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Wes Turner
google/paranoid_crypto has a number of Randomness Tests in Python IIR >From grep '^#' https://github.com/google/paranoid_crypto/blob/main/docs/randomness_tests.md : ```md # Randomness tests ## Goal of the tests ## Non-goals ## Usage ## Tests ### NIST SP 800-22 Frequency (Monobits) Test F

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread James Johnson
I am an amateur enthusiast. The random function I found in documentation was in 2014 or so. I do not have the vocabulary to differentiate between various prng's. I only knew of one, and I it returned some version of the bell curve, with three favorite values, and one of THEM a pronounced preference

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Chris Angelico
On Wed, 16 Nov 2022 at 00:59, James Johnson wrote: > > Chris A. asked me to "post" a module. I'm pretty sure he means on git-hub, > and I don't know how to use it. I attach a script with a randbelow() function. No no, here is absolutely fine :) Although the code you posted doesn't run. There are

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Steven D'Aprano
On Sat, Nov 05, 2022 at 01:37:30AM -0500, James Johnson 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. First the good news: your random number genera

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Wes Turner
"Do hash functions such as SHA-2 and SHA-3 output random numbers, and are they therefore good P/RNGs?" https://www.quora.com/Do-hash-functions-such-as-SHA-2-and-SHA-3-output-random-numbers-and-are-they-therefore-good-P-RNGs - ```quote See NIST.SP.800–90A. It details how to use both hash functions

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Steven D'Aprano
On Tue, Nov 15, 2022 at 05:10:06AM -0500, Wes Turner wrote: > There should be better software random in python. Better is what way? What do you think the current MT PRNG lacks? -- Steve ___ Python-ideas mailing list -- python-ideas@python.org To unsu

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Steven D'Aprano
Wes, what purpose do you think these data dumps have? -- Steve ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Messag

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Wes Turner
These are citations for your PEP (the template for which I linked to in my first messadge in this thread) Are these now the questions: Is an or the initially-posted MD5 DRBG (without a standard KDF) more optimal than the existing Mersenne Twister MTRNG variant that's in the CPython(,) standard li

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread James Johnson
I composed in VI, and the tabs were a problem. I apologize; there is no good excuse not to have called the function before attaching it. I had a logic problem. Accumulating the decimal conversion of hex needed to be modular divided to be within range, and I had the name of the hex string (pool) wr

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread James Johnson
That list teaches a vocabulary in which to speak about randomness. Since my attempt draws its inspiration from addition, I fear it may not pass other tests. Thank you for the list. Also, many PRNG’s to call. That will help immensely. You have shown patience in addressing my effort, but I’m not op

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Wes Turner
How does this algo differ from Hash_DRBG and/or HMAC_DRBG in NIST.SP.800-90Ar1.pdf https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf ? Good luck! On Tue, Nov 15, 2022 at 10:25 AM James Johnson wrote: > That list teaches a vocabulary in which to speak about randomness.

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread James Johnson
Thanks! (I was ignorant; reinventing the wheel if mine is adequate) On Tue, Nov 15, 2022 at 9:41 AM Wes Turner wrote: > How does this algo differ from Hash_DRBG and/or HMAC_DRBG in > NIST.SP.800-90Ar1.pdf > https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf > ? > > Good

[Python-ideas] Re: Better (?) PRNG

2022-11-15 Thread Wes Turner
Good discussion. awesome-python-benchmarks lists a few tools: https://github.com/microprediction/awesome-python-benchmarks - wesm/vbench looks out of date - facebook/nevergrad: https://facebookresearch.github.io/nevergrad/benchmarking.html#adding-your-own-experiments-and-or-optimizers-and-or-tes