Dr. Drang over at leancrew.com just wrote up an excellent article assessing the randomness of James Thompson's new app Dice by PCalc (which I have been running the beta of since around launch). In the post, they give a nice explanation of the Chi-Square test and how he used it to test just how random the app's dice rolls were. You can check out the post (and the results!) here.
Now it was time to analyze the data. First, I cleaned up the data by searching for all the newline characters and deleting them. That gave me one long string of numerals that I could paste into my Python analysis script.
The purpose of the script is to count all the occurrences of each number. We can then use the chi-square test to see if the counts are close enough to equal to be considered uniformly distributed.
This is both a fun test of a dice app's randomness in a statistical sense, as well as a good example of how the Chi-Square test assesses if differences from an expected value are the result of chance or not.