I'm referring to a [program][1] called `ent` that is commonly used to test the quality of random number generators. The following is a typical result (and a good pass):-



    $ ent /tmp/urandom-500MB
    Entropy = 8.000000 bits per byte.
    
    Optimum compression would reduce the size
    of this 524288000 byte file by 0 percent.
    
    Chi square distribution for 524288000 samples is 264.86, and randomly
    would exceed this value 32.26 percent of the times.
    
    Arithmetic mean value of data bytes is 127.4993 (127.5 = random).
    Monte Carlo value for Pi is 3.141621289 (error 0.00 percent).
    Serial correlation coefficient is 0.000036 (totally uncorrelated = 0.0).



Please note the result for the Chi square distribution. The program offers a likelihood of the result (of 32.26%) occurring by chance.

Now please note the results for the arithmetic mean of the bytes, and the Monte Carlo calculation for Pi. This is obtained by taking the input sequence bytes in tuples of six for an x coordinate, and six for a y coordinate, and performing [this][2] type of Pi approximation.


Q: How can we add likelihood percentages to both arithmetic mean and Pi calculations?




  [1]: https://www.fourmilab.ch/random/
  [2]: https://en.wikipedia.org/wiki/Approximations_of_%CF%80#Summing_a_circle's_area