Post Reply 
[VA] SRC #011 - April 1st, 2022 Bizarro Special
04-14-2022, 12:49 PM (This post was last modified: 04-15-2022 06:34 PM by Albert Chan.)
Post: #31
RE: [VA] SRC #011 - April 1st, 2022 Bizarro Special
(04-12-2022 06:37 PM)J-F Garnier Wrote:  my sequence [previous seed] PI * FRAC always gives 9 decimal places.

Amazingly, above random generator is so bad, it is more likely get the right answer Smile

s = FRAC(deg(s)), for (1+RND-RND), we get expected triangular distribution.

>>> def r(): global s; s*=m; s-=int(s); return s
...
>>> m, s, t = 57.295779513082323, 1, [0]*20
>>> for i in range(100000): t[int(10*(1+r()-r()))] += 1
...
>>> for i in range(20): print (i+.5)/10, '*' * int(t[i]/200+0.5)
...
0.05 **
0.15 ********
0.25 ************
0.35 *****************
0.45 ***********************
0.55 ****************************
0.65 *********************************
0.75 **************************************
0.85 *******************************************
0.95 ************************************************
1.05 ***********************************************
1.15 ******************************************
1.25 **************************************
1.35 ********************************
1.45 ***************************
1.55 **********************
1.65 *****************
1.75 *************
1.85 ********
1.95 ***

s = FRAC(PI*s), and same seed of 1, we get this instead

>>> m, s, t = 3.1415926535897931, 1, [0]*20
>>> for i in range(100000): t[int(10*(1+r()-r()))] += 1
...
>>> for i in range(20): print (i+.5)/10, '*' * int(t[i]/200+0.5)
...
0.05
0.15
0.25
0.35 *******************
0.45 ************************
0.55 ************************
0.65 **************************************
0.75 ****************************************************
0.85 ****************************************************
0.95 **************************************************************
1.05 *******************************************
1.15 ********************************************
1.25 *********************************************
1.35 **************************
1.45 *********************
1.55 *********************
1.65 ********
1.75
1.85 *********
1.95 ************

>>> t
[0, 0, 0, 3857, 4859, 4853, 7512, 10460, 10454, 12339, 8511, 8838, 9051, 5188, 4293, 4155, 1554, 0, 1715, 2361]
>>> sum(t[0:10]), sum(t[10:])
(54334, 45666)

This has distribution slightly closer to singularity, but with zero chance of getting too close !

Update: I was wrong.

JFG's rand generator, s = FRAC( PI*s ), F converge to 0.941
VA's rand generator, s = FRAC(DEG(s)), F converge to 0.925, almost dead-on (true F = 0.926)

The only problem is that it take a lot of random numbers for F convergence.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #011 - April 1st, 2022 Bizarro Special - Albert Chan - 04-14-2022 12:49 PM



User(s) browsing this thread: 4 Guest(s)