How to Test for Randomness

Suggestions on how you can test if a sequence of numbers is actually random

George Pipis
The Startup

--

I have been contacted by many people asking me to predict the outcome of some events that in theory are random. For example, they want me to predict lottery games like Keno, Lotto, Casino Roulette numbers and so on so forth. My answer is that you cannot predict something which is supposed to be random. No model can give you a better estimate than what you already know, for example, in roulette the probability to get the number 0 is 1/37 no matter what were the previous numbers. This implies that before start building advanced Machine Learning and Artificial Intelligence models to predict the outcome of the next draw, try to check if these numbers are actually random. If they are actual random then it means that there is no pattern and you should not waste your time with ML and AI.

For demonstration purposes, we will assume that we are dealing with numbers obtained from an unbiased casino roulette with numbers from 0 to 36. Let’s create our sample in R.

set.seed(5)# Generate 10K random numbers from 0 to 36
casino<-sample(c(0:36), 100000, replace = TRUE)

Chi-Square Test for the Frequency of the Numbers

--

--

George Pipis
The Startup

Sr. Director, Data Scientist @ Persado | Co-founder of the Data Science blog: https://predictivehacks.com/