As mentioned recently in some of the Pi related threads, I've prepared a small collection of Pi and E related functions and routines, thus the PIE nickname - and I'm glad to say it's is finally ready.

Here you can also find the RANDOM ROM, a small compendium of RNG's and applications based on them that should provide some amusement to those interested.

Manuals will follow (I'll try posting them here as the room allocation rules allow it)

Note that the Library#4 is required for the PIE ROM.

Enjoy,

ÁM

Hi Ángel,

Your mention of the Toulouse Math ROM (TOULMATH) revived my interest for this ROM recovered only

recently.

However, as my friend Mike (Stgt) pointed me out by PM, the TOULMATH and your RANDOM ROMs give different results for RAND:

PI

STORAND

; ----------- TOULMATH 0C - RANDOM 1C

RCLRAND ----> 0.314159265 0.314159265

RAND -------> 0.898387113 0.379167113

RAND -------> 0.234304858 0.754274858

RAND -------> 0.057381981 0.260151981

RAND -------> 0.102112763 0.904492763

(tested on Emu41)

J-F

Edited: P.S. By calling Mike "my friend" I don't mean

by any mean that I agree/approve/endorse any opinion/criticism/polemic that Mike may issue elsewhere.

(04-28-2022 08:03 AM)J-F Garnier Wrote: [ -> ]However, as my friend Mike (Stgt) pointed me out by PM, the TOULMATH and your RANDOM ROMs give different results for RAND:

I've identified the line in the code that causes the difference so I can change it to replicate the original results. The interesting question is whether the "different" results had a better randomness, but I guess we want them to be exactly as the original so I'll make the change.... stay tuned.

A quick update on this topic:-

I changed the diverging line to use the same exact code present in the TOULMATH, matching the table you included above. To my surprise this also matches 100% the results obtained with the Voyager's version, which is a bit of a setback because with that being the case the two different RGNs converge into one, as both are producing the same results.

The curious angle to this is that the "modified" TOULMTAH RNG yields better results when used in the Gaussian RNG methods, i.e. the results had a better "normality". On the other hand, the "randomness" of the modified and original TOULMATH were very similar

For all this I have therefore decided to leave it as it was. with the modification - even if it isn't the strict original from the TOULMATH module. (which is still there, just use the Voyager's results instead and call them "Original TOULMATH ;-)

Cheers,

ÁM

(04-29-2022 09:26 AM)Ángel Martin Wrote: [ -> ]The curious angle to this is that the "modified" TOULMTAH RNG yields better results when used in the Gaussian RNG methods, i.e. the results had a better "normality". On the other hand, the "randomness" of the modified and original TOULMATH were very similar

100 points sample size might be too small to deduce which GRN is better.

Also, "normality index" from 6 quantiles points might be too little.

Instead of checking "normality", we could apply "cdf", turn them back to uniform randoms.

Checking for uniform random distribution is much easier.

Scatterplots may be enough to call the "winner".

This got me thinking ...

Why not use 1 uniform random, apply inverse cdf, to get 1 GRN ?

icdf(p) = ierfc(p*2)*-sqrt(2), and

ierfc can be cheaply calculated.

lua> T = setmetatable({}, {__index = function(F, i) return 0 end})

lua> for i=1,1e6 do x=round(

icdf(random())*4)/4; T[x]=T[x]+1 end

lua> T[0] / 1e6 -- slot for z within +/- 1/8

0.09953

lua> cdf(1/8)*2 - 1 --> distribution matched standard normal

0.09947644966022584

lua> for z=-4,4,1/4 do print(z,('*'):rep(T[z]/1400)) end

-4

-3.75

-3.5

-3.25

-3 *

-2.75 **

-2.5 ***

-2.25 ******

-2 **********

-1.75 ****************

-1.5 ***********************

-1.25 ********************************

-1 ********************************************

-0.75 ******************************************************

-0.5 ***************************************************************

-0.25 *********************************************************************

0 ***********************************************************************

0.25 *********************************************************************

0.5 ***************************************************************

0.75 *****************************************************

1 *******************************************

1.25 ********************************

1.5 ***********************

1.75 ****************

2 **********

2.25 ******

2.5 ***

2.75 **

3 *

3.25

3.5

3.75

4