in reply to guessing next number on roulette wheel

Before you start coding you need to decide on your assumptions and the statistical models you want to apply. You can just use any you can find coded in Perl but usually one uses a statistical package like R or SAS to analyze the data.

Once you know your statistical procedure you want to use you can look for it or code it.