# Possible? (roulette patterns)

Discussion in 'Mac Programming' started by zainjetha, Feb 17, 2011.

1. ### zainjetha macrumors 6502a

Joined:
Aug 11, 2007
#1
Hi Guys

I have had this idea for quite a while now but have never actually ever gotten round to starting. I was wondering if you would all be willing to put forward some thoughts and give a little advice. I have very little experience with programming but am willing to learn.

Basically, I feel that online roulette tables are greatly flawed in the sense that as compared to real roulette tables they are not completely 'random'. Apparently they use something called RNG (random number generation) but I am certain that the roulette table does over a period of time eventually repeat an algorithm. My aim is to try and identify this algorithm and then bet according to it to exploit the bookmaker.

Basically, I would divide the task/problem into three logical phases

1) I would need to write a program which is able to interact with the roulette GUI and is able to record the results of the spins. It would need to record the result as something like 1 Red as 1R, or a zero as simply 0. It would simply record the data raw, and then it would need to be entered into a spreadsheet as a result according to the spin number.

2) We are now left with this huge volume of data related to spins. It would be necessary for the spreadsheet to produce a line graph or something of a similar nature and thus a pattern may emerge, thus proving that the outcomes of spins eventually boil down to sequence, however it may be over 500,000 spins.

3) Bet on the pattern discovered.

LIMITATIONS OF MY APPROACH

1) Hard to identify when you begin spinning the position you are at in the algorithm
2) The roulette algorithm may be specially designed to produce the results where you haven't bet or designed to produce the result of the square you have placed the chip of lowest value on. In essence, the roulette algorithm may be designed to ensure that over a period of time, either short- or long-term, you do not end up as a winner.

I know that I have summarised the task quite extensively in this post, but am aware that it is a very complex task and that I would have to break each task down into several several smaller ones.

I know it might sound like a crazy idea, but please, only those who are willing to help and not tell me i'm nuts. I would be grateful for any small help anyone is able to donate.

I am sorry if i have posted in the wrong forum.

2. ### Hansr macrumors 6502a

Joined:
Apr 1, 2007
#2
You don't know enough about random number generators to do this, or stats or numerical analysis. For MT19937 which has a period of 2^19937 − 1 and is a popular RNG. You can back out a seed and recreate the series of future numbers if you have 624 sequential non-casted observations from the same seed. But unfortunately what you have is numbers cast to u[0,1]*37/38 so you don't have a clean observation. Even if you were getting the pure numbers they'd only have to reseed based on something like the current time every x samplings to throw off anything like you suggest.

If you want to look at something similar where the house doesn't have a chance to cheat against you might be better of looking at stat arb in stocks or fx instead although there you'd be betting against HFT but at least you could do some things in the more illiquid stuff. Check the algo trading groups on linkedin or one of the trading forums for more info, it would at least be a similar project but with a chance of going somewhere; whereas this will not lead to anything.

3. ### chown33 macrumors 604

Joined:
Aug 9, 2009
Location:
Sailing beyond the sunset
#3
Not only that, but any cryptographically strong PRNG will have the ability to mix in ongoing additional entropy. So if the table was using something like Yarrow, and periodically mixing in new entropy, then the sequence is unpredictable for all practical purposes.

FWIW, the /dev/random and /dev/urandom devices typically use an algorithm like Yarrow, and continually update the entropy pool. See: man urandom.
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man4/urandom.4.html

The OP has failed to provide one iota of evidence that this premise is anything but wishful thinking (or magical thinking).

The OP has at least one other faulty premise: that these are mutually exclusive.

4. ### Hansr macrumors 6502a

Joined:
Apr 1, 2007
#4
Not related to the topic at hand but if you read some of Ed Thorp's old work from the 60s or 70s he did come up with a fairly decent method of predicting the outcome of the roulette tables number but it had to be initiated and calculated by a mechanical device with a visual access to the ball and it had to be initiated once the ball was moving. I don't think it made it into any of his books but some papers on it should be available via google.

Doesn't work today obviously but it's a fun read none the less.

5. ### zainjetha thread starter macrumors 6502a

Joined:
Aug 11, 2007
#5
Hi guys

Thanks Hansr, really appreciate your reply however it is slightly too complicated for me.

However, I don't see why I need to understand these concepts - all I need to be able to do is capture the results and eventually over a long long period of time a pattern should emerge.

All I will have to do is conduct data analysis.

6. ### robbieduncan Moderator emeritus

Joined:
Jul 24, 2002
Location:
London
#6
Unfortunately your lack of understanding of the concepts if leading you to a false conclusion. If you spent some time and understood the concepts you would realise that no pattern would emerge.

7. ### mfram macrumors 65816

Joined:
Jan 23, 2010
Location:
San Diego, CA USA
#7
To the O.P., I hope you realize what you are describing isn't a programming problem. It's a mathematical analysis problem. As such, this really isn't the right forum.

Your only hope doing anything useful with the data is if the random number generator being used is flawed. It's certainly possible, but if I were running something that required good "random" numbers, I would spend a lot of time working on that system.

Even if the RNG is flawed, your best hope is a slight statistical anomaly. You probably won't be able to predict the sequence (unless the system design is very badly broken), you'll probably only get a slight bias that might give you a few percentage points of advantage. The edge you could gain would probably be pretty small.

And keep in mind this requires a LOT of data. How would you get this data? If you have to spin manually, or if it takes more than a second to get a spin there's no way you'll enough data to determine anything for a long time. And if this data costs you money, your cost will be quite high.

8. ### zainjetha thread starter macrumors 6502a

Joined:
Aug 11, 2007
#8
Flawed in what sense? It is probably that it is just an extremely long algorithm which indents and indents and has several conditions. If on the settings I change the setting to 'fast spin' the result is immediate. On one occasion I clicked the spin button maybe say ten times in a row and it merely sounded like the computer was reading out the results.

The main obstacle, I believe, would be to get a system in place which can capture the data. Once that is in place, maybe a quarter of the battle is over.

9. ### robbieduncan Moderator emeritus

Joined:
Jul 24, 2002
Location:
London
#9
It's clear you have no interest in listening to the advice you are being given. Your basic premise "It is probably that it is just an extremely long algorithm which indents and indents and has several conditions" is wrong. As you are not willing to listen to any number of people telling you that this is not going to work why don't you go ahead and try it?

### Staff Member

Joined:
Aug 16, 2005
Location:
New England
#10
What makes you think that?

The previously mentioned MT19937 isn't what you describe and will only repeat over a very long time. http://en.wikipedia.org/wiki/Mersenne_twister

Actually, read: http://wizardofodds.com/roulette and see what you can do with their 1,000,000 spins. They could just be using that list as a lookup table and it wouldn't really repeat for a million spins.

B

11. ### Hansr macrumors 6502a

Joined:
Apr 1, 2007
#11
I think you'll see the most value out of this project proposal by implementing MT19937 yourself and from there seeing how impossible this is.

12. ### ender land macrumors 6502a

Joined:
Oct 26, 2010
#12
And this is then of course assuming the algorithm even repeats indefinitely and isn't seeded by the time the table is opened, etc.

13. ### gnasher729 macrumors P6

Joined:
Nov 25, 2005
#13
I can tell you that a very early version of the KISS random number generator with a period of 2^128 was considered cryptographically broken because it could be cracked if 2^29 consecutive values are available. That is 500 million values. So if they used this "broken" algorithm then one million numbers would get you absolutely nowhere. 500 million values wouldn't get you anything either, because most of the information you need disappears when the numbers are turned into roulette numbers from 0 to 36.

So if they used this clearly broken algorithm, your chances are nil. If they used something better (like a newer version of the KISS algorithm with a period of 10 to the 40,000th power), your chances are still nil but a much much smaller nil

14. Feb 18, 2011
Last edited: Feb 18, 2011

### SidBala macrumors 6502a

Joined:
Jun 27, 2010
#14
Say you have a trillion roulette wheels for every atom in the universe. And all these wheels share one RNG. Now say if you could spin all those wheels once every nano second and record all the results instantly.

And say you keep recording the results for a time period as long as the age of the universe.

You would still have only gone through around 2^400 numbers. Even this is nowhere close to the 2^19937 someone mentioned.

Now do you see what the fundamental problem is?

But say if you had infinite time, there are still very easy ways to make your method not work. For example as someone mentioned: Seeding the RNG with the time.

### Staff Member

Joined:
Aug 16, 2005
Location:
New England
#15
Or, for an online multi-player game, using the same RNG for multiple simultaneous games, ... You get one spin, another player gets the next, etc...

B

16. ### dmi macrumors regular

Joined:
Dec 21, 2010
#16
If online roulette table uses a non-cryptographically strong algorithm, such as MT19937 or most random number generating algorithms, then it would be possible to predict the sequence after making enough observations to reconstruct the information in the seed.
If a cryptographically secure random number generator is used, then you would have as much luck as trying to break a strong encryption algorithm.
Non randomness in physical roulette tables can be predicted well enough to gain a statistical advantage given sufficiently careful observation. However for the level of skill and effort necessary to attain that advantage, one could probably find other more profitable endeavors, particularly since gambling establishments are unlikely to allow you to exercise your advantage for very long.

### Staff Member

Joined:
Aug 16, 2005
Location:
New England
#17
As gnasher729 and Hansr have pointed out, you lose most of the information required to back out the seed when you map the generated 32 bits numbers on to the roulette numbers (less than 5 bits). What you say is true if you had access to the actual random numbers generated, but you don't you only have a hash.

Apart from that I fully agree with your post.

B

18. ### kuwisdelu macrumors 65816

Joined:
Jan 13, 2008
#18
As a statistician and someone who understands a bit about pseudorandom number generation and programming, the best and most helpful advice I, or any of us, can give you is to give up. You've been offered plenty of reasons why your idea won't work, but you don't seem to want to take the time to understand them.

19. ### zainjetha thread starter macrumors 6502a

Joined:
Aug 11, 2007
#19
OK Guys

Thanks for all your help. You have helped me to understand that this project is for all practical purposes useless therefore I would not like to waste anybody's time.

I would request the moderators to delete this thread as it is likely to be of little use to anybody.

Kind regards

### Staff Member

Joined:
Aug 16, 2005
Location:
New England
#20
The thread is full of useful links so I would hope they don't choose to delete it.

B

21. ### jiminaus macrumors 65816

Joined:
Dec 16, 2010
Location:
Sydney
#21
I would disagree with having this thread deleted. Zainjetha, you're not the first to think of exploiting the periods in RNGs to cheat gambling games. This thread will similarly inform those people of the unfeasibility of this.

22. ### chrono1081 macrumors 604

Joined:
Jan 26, 2008
Location:
Isla Nublar
#22
Despite this thread reminding me of my Discrete Mathematics class, I actually enjoyed reading through it and learning about the different RNGs.

Also OP Discrete Mathematics is probably an area to start looking in for the types of questions you are asking. A lot of it deals with gambling games and probabilities and such.

23. , Feb 19, 2011
Last edited by a moderator: Feb 20, 2011

### dmi macrumors regular

Joined:
Dec 21, 2010
#23
More numbers would be needed, and the analysis could become more more involved, but it's still a lot easier than breaking a good encryption, unless you start with a cryptographically secure pseudo-random number generator.

Since the time is highly non-random, this can actually make the analysis easier.
If you know how many other players there are, it only modifies the analysis slightly.
If you don't know how many spins there are between the samples that you see,
then that represents a few more bits of information you need to reconstruct, which may require a few more samples.
But still far less than a full cycle of the random number generator.

But a conscientious designer of an online roulette table would probably want to avoid the use of cryptographically insecure random number generators that would make such analysis feasible.

### Staff Member

Joined:
Aug 16, 2005
Location:
New England
#24
I think you are assuming that you know how the 32 to 5 bit reduction is done. There are plenty of maps that could be used to further confound that.

If the time required to game the system becomes longer than the game's lifetime it's good enough.

I agree that anyone designing such a game would be knowledgeable enough to use a crypto secure PRNG.

B

25. ### whooleytoo macrumors 604

Joined:
Aug 2, 2002
Location:
Cork, Ireland.
#25
If I could add a less technical/mathematical; and more social/legal: with a computer generated gambling system, how on Earth can you know they're even 'honestly' using a RNG, and not manipulating the results to reduce the win rate?

I don't do online gambling (probably for this reason! ) but it seems to me it would be very easy for these systems to cheat. Are they in any way regulated?