Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

guessing next number on roulette wheel

by sk.kumar (Initiate)
on Sep 14, 2018 at 12:31 UTC ( [id://1222356] : perlquestion . print w/replies, xml ) Need Help??

sk.kumar has asked for the wisdom of the Perl Monks concerning the following question:


I am talking about roulette wheel to give a perspective, but in reality, my data is from 00-99 , I want to design a programme that can analyze a large quantity of data, and then try to predict what will be the next digit. on the same principle, I have a data of 3 digit numbers 100-999 , and predict the next number

I know perl, but am not a master, if anyone can point me in the right direction, (approch ,and CPAN modules)

Thanks in advance

Replies are listed 'Best First'.
Re: guessing next number on roulette wheel
by Happy-the-monk (Canon) on Sep 14, 2018 at 13:30 UTC

    talking about roulette wheel ... try to predict what will be the next digit.

    Unless your specific roulette wheel has been rigged, there is no way to predict any number from past data.
    Unlike card games, Roulette "resets" the possibilities to be either 1 in 37 (or 1 in 38 in the case of two zeroes on the wheel) just as they were at any time in the past.

    Cheers, Sören

    Créateur des bugs mobiles - let loose once, run everywhere.
    (hooked on the Perl Programming language)

Re: guessing next number on roulette wheel
by hdb (Monsignor) on Sep 14, 2018 at 13:21 UTC

    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.

Re: guessing next number on roulette wheel
by Marshall (Canon) on Sep 14, 2018 at 17:27 UTC
    I suggest that you start with a google search on "random number validation". I think you will find some statistical tools that you can run to see how random or not the data actually is. These statistical tests won't tell you what a predictive algorithm would be, but hopefully would give you some idea of whether or not such a thing is even theoretically possible. If the data is truly random, then looking backward over a relatively small interval you may (and probably will) see some pattern. But that piece of data would have no predictive value moving forward.

    Of course a key piece of information would be "where do these numbers come from?". You haven't told us that. From your posts, I take it that this is not a roulette wheel.

    You mentioned somewhere that maybe it takes 5 hours for the next number. There may be some correlation between time and the next number? I have a web application that reports tournament results. The number of hits per hour is definitely not random and has a lot to do with whether or not we ran a major tournament over the weekend. How many hits we will get in the next hour is highly correlated with how many hits we got last hour. Nothing happens for a long time - then something happens. The probability that something more will happen in the next hour is vastly increased.

    There is a lot of Perl experience in the group, but we have virtually nothing to go on. Run some validation tests as suggested above, then tell us more about what you are actually doing.

Re: guessing next number on roulette wheel
by rizzo (Curate) on Sep 14, 2018 at 14:00 UTC
    ... if anyone can point me in the right direction ...

    As a first step I'd try to figure out if the data is
    a.)"real" random, meaning the data is generated by a real world process with random outcome
    b.) pseudo random, taken from a pseudo random number generator(pnrg) applying a given probability distribution.

    If case a.) applies You could calculate the probabilty distribution and guess the next number based on the result. If case b.) applies, try to figure out the pnrg and the seed doing "some" correlation.

Re: guessing next number on roulette wheel
by marto (Cardinal) on Sep 14, 2018 at 12:44 UTC

    "I want to design a programme that can analyze a large quantity of data, and then try to predict what will be the next digit."

    If you want help writing or designing a program, you're going to have to do a better job of explaining what you are trying to do. How do I post a question effectively?.

Re: guessing next number on roulette wheel
by davies (Prior) on Sep 14, 2018 at 21:45 UTC
Re: guessing next number on roulette wheel
by hippo (Bishop) on Sep 14, 2018 at 13:04 UTC
    predict the next number

    See rand.

Re: guessing next number on roulette wheel
by Anonymous Monk on Sep 14, 2018 at 15:04 UTC
    This margin post is too narrow to contain the complete answer to your question, but if you research time series prediction, it should give you a few starting pointers. Your problem is very complex and extremely hard to solve.
Re: guessing next number on roulette wheel
by bliako (Monsignor) on Sep 14, 2018 at 14:34 UTC

    Is the roulette faulty or the croupier a cheat?

Re: guessing next number on roulette wheel
by sk.kumar (Initiate) on Sep 14, 2018 at 13:12 UTC
    Trying to frame the question again

    I have a large data of random numbers from 00-99, suppose every 5 hours one more random number is added to the data pool,

    I want to write a perl programme, which can analyze the data, figure out the patterns(may involve one or many algorithms) in the data, and try to predict what will be the next number which will be added to data pool(the predicted number can be 1 or a set of numbers)

    88 11 36 43 90 66 48 19 77 04 90 91 47 62 97 10 12 84 82 88 25 28 ??

      As has been suggested already++, rand is as good a starting point as any for guessing a random number. You could probably try a best-fit polynomial, though it's doubtful it would perform any better at guessing the next random number than rand() would. It really depends on how random it is.

      In the 90s, I would have said, "make an artificial neural network", and I guess nowadays, I would say the equivalent "machine learning"... but given that no one has broken the stock market with their hugely-above-average performing ANN/ML/AI systems, I doubt that'd have a much higher success rate than rand().

      If it's a computer-generated random number (PRNG) to begin with, you could try to reverse engineer whatever PRNG is being used to by the "roulette" wheel, but with all the various manipulate-and-mod methods, with their huge numbers of possible state values, make that a daunting perspective. (If you know which implementation of their rand() function, you'd have a better chance of brute-forcing the state, especially if it's a smaller number of bits in their algorithm.)

      If it's something more truly random (ie, a non-rigged physical process), then all bets are off, and rand() is as good as you're likely to get. If it is rigged, then you've got a better chance, and doing best fits, or other statisitical analysis, would be a good starting point.

      Oh, I seee that Happy-the-monk mentioned rigged roulette wheels while I was writing this up, and hdb suggested some statistical packages to use to analyze data. That makes my post all-but-superfluous, but it will still be posted due to sunk costs. :-)

      Either you can give us a hint what you think the next number is or you are expecting Perl to be more intelligent than you are.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Re: guessing next number on roulette wheel
by sk.kumar (Initiate) on Aug 16, 2021 at 18:34 UTC

    Hi Guys... I am really sorry.. I was busy with some other work, and did not get time to look at this, and later forgot about it..

    so to give you more perspective .. I will be taking data from this website Kalyan penal chart .

    Let's take an example "168 =>59<=667" , Here the result is declared in two parts,
    Suppose 168 is declared at 2 PM (is called OPEN PANEL), then and 667 is declared after 3 hours(is called CLOSE PANEL),
    Now, 1+6+8 = 15 .. only the Unit's place (last digit is considered, i.e 5), similarly 6+6+7 = 19 (9 is considered).

    Now people can bet on many different aspects with varying prize amount..

    • just 5 as OPEN, or 9 as CLOSE (winnings 1:9)
    • or 59 as BRACKET (winnings 1:90)
    • 168 as OPEN panel or 667 as CLOSE panel (winnings 1:250).

    My program should be able to predict next BRACKET, or OPEN PANEL or/and CLOSE PANEL

      So in all these years what progress have you made with this?

        As I told before... I have not started on it till now... As, asked by some people, I have now given as much perspective as I can...hope some enlightened minds can point me right direction