@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> 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
>
> --
> Greg
>
> _______________________________________________
> 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/JNK52FQDWCDRFNWB2PXTGTXVWUDYKLVJ/
> 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/BSQRQYX2WHUYZZGKPOG5T62I2VSPT2SZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to