Yes, I ran a simulation where 4 repeated values are not counted as 2, and found something close to 5.38. There is also a slight inaccuracy in my formula when counting repeated values that are (or not) at the beginning/end of the sequence.
Le mar. 6 déc. 2022 à 11:54, Benedict Verhegghe <bver...@gmail.com> a écrit : > The difference is probably because I count 4 repeated values as 2 > triples, etc..., while the 5.382 value counts them only once? > > Benedict > > -------- Original Message -------- > From: Benedict Verhegghe > Sent: Tuesday, December 6, 2022 at 10:38 UTC > To: python-ideas@python.org > Subject: [Python-ideas] Re: Better (?) PRNG - follow up > > > I used a brute force method to check the probability. Counted the number > > of triples in 600 random numbers 0-9, repeated that 10000 times and took > > the mean: 5.99 > > So it looks like Chris's number is more accurate. > > > > Benedict > > > > Op 6/12/2022 om 09:25 schreef Alex Prengère: > >> @Chris Indeed the true figure, if my math is correct, is a bit under > >> 5.98 because of the "non-independence" of triplets. > >> I computed it and found 5.382, so finding 6 is entirely normal. > >> > >> For the details: calling L = 600 and n = 3 > >> * number of possible sequence of L digits: 10^L > >> * if a specific digit appears in a specific position n times, the rest > >> of the sequence has 9*10^(L-n-1) possibilities [9 because after the > >> repetition you have a different digit] > >> * we need to multiply that number by 10 as we have 10 digits > >> * we need to multiply it again by L-n+1 as the digit can start in > >> any place until the L-n+1 place > >> * so the total number of sequence of L digits with at least 1 > >> repetition of length n is: 9*10^(L-n-1) * 10 * (L-n+1) > >> > >> Dividing the 2 to compute the probability: > >> P = 9*10^(L-n-1) * 10 * (L-n+1) / 10^L = 9*10^(L-n) * (L-n+1) / 10^L > >> > >> $ python3 -c "L = 600; n = 3; print(9*10**(L-n) * (L-n+1) / 10**L)" > >> 5.382 > >> > >> Regards, > >> Alex > >> > >> Le mar. 6 déc. 2022 à 07:34, Greg Ewing <gcew...@snap.net.nz > >> <mailto:gcew...@snap.net.nz>> a écrit : > >> > >> On 6/12/22 3:58 pm, James Johnson wrote: > >> > I came back to this thread looking for the list of randomness > >> tests, and > >> > I keep missing them somehow. > >> > >> If you're interested in testing a PRNG really thoroughly, check > >> out TestU01: > >> http://simul.iro.umontreal.ca/testu01/tu01.html > >> <http://simul.iro.umontreal.ca/testu01/tu01.html> > >> > >> -- Greg > >> > >> _______________________________________________ > >> Python-ideas mailing list -- python-ideas@python.org > >> <mailto:python-ideas@python.org> > >> To unsubscribe send an email to python-ideas-le...@python.org > >> <mailto:python-ideas-le...@python.org> > >> https://mail.python.org/mailman3/lists/python-ideas.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/JNK52FQDWCDRFNWB2PXTGTXVWUDYKLVJ/ > < > https://mail.python.org/archives/list/python-ideas@python.org/message/JNK52FQDWCDRFNWB2PXTGTXVWUDYKLVJ/ > > > >> Code of Conduct: http://python.org/psf/codeofconduct/ > >> <http://python.org/psf/codeofconduct/> > >> > >> > >> _______________________________________________ > >> 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/ > >> Message archived at > >> > https://mail.python.org/archives/list/python-ideas@python.org/message/BSQRQYX2WHUYZZGKPOG5T62I2VSPT2SZ/ > >> Code of Conduct: http://python.org/psf/codeofconduct/ > _______________________________________________ > 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/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/R6J6XQ6SX3XT3ROBJYZYZDRZEIYBBS7Y/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ 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/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/J5ALN7OZHHQNUCZWUAM53YDNHWSC7VQ2/ Code of Conduct: http://python.org/psf/codeofconduct/