Showing posts with label Randomness. Show all posts
Showing posts with label Randomness. Show all posts

Friday, 9 January 2015

Roulette excel isn't the same as mechanical wheels

I've spent  a lot of time so far giving you the tools on how to calculate probabilities and check if staking plans work in excel.

The game of roulette isn't played in Excel, it's played on a mechanical wheel (unless you are playing online in a non-live roulette game and then you may as well be playing in Excel).

So what's my point:

If your number based system (martingale, reverse martingale etc)  doesn't hold up in Excel, it won't hold up in the real world either.

Ahhhhh, but you said in the real world, it's mechanical wheels, so there are wheel biases, dealer signatures etc, so maybe my system does hold up in the real world and not in Excel?

sure maybe, but that's blind luck.   does every dealer have the signature, every wheel have the same bias?  if that's what you think then you're crazy.

If you want to look at real world advantage play then we'll get to that but if your number based system doesn't hold up in excel it won't hold up with mechanical wheels.   if you want something to hold up with mechanical wheels then you need a different strategy.   and we'll get to that.

hope this helps

Thursday, 8 January 2015

Hot numbers in roulette

I'm not gonna name the site but I was looking at yet another person peddling their roulette strategy based on tracking numbers (no genuine advantage play).

Basically, you stick in the last 6 numbers and voila, it will tell you where to bet.   If the wheel spins 3, 4, 5, 14, 15 and 17.   You should probably bet on 19-36, cause those numbers are due....

Just for fun, let's see how that looks in the Excel Simulator

The Random Numbers

This is what my Excel Random Number generator produced (feel free to replicate this experiment yourself)

3, 14, 9, 9, 3, 21, 35, 3, 29, 0, 19, 36, 4, 9, 5

The distribution

Oh look the number 3 came up 3 times (surely that's a hot number)????  BTW, that was sarcasm.   We know enough about random numbers now to know that that can easily happen.  However this could be an interesting blog post in the future.   Hot numbers.

What might be more interesting is the ranges, which is what they were betting on in this system.


Their system was either avoid betting on 1 to 12 because it's hot.  but it might have been bet on 1 to 12 because it's hot.

There is no hot....  It's just some random numbers.   nothing is due or not due....

The kicker
And here was the kicker.  Don't worry, if you lose, just martingale and it'll recover your losses.

And we know how that ends...

Anyways, you know my thought on this sort of thing already.  I could type up their system into Excel and formally disprove it.   But you can always do that yourself if you want.

We know enough about random numbers, streaky numbers and martingale to know this is a silly strategy.

For more info on streaks, read my post on streaky coin tosses
For generating roulette numbers in excel, read my post (or look at the martingale one)

Why playing Red or Black in Roulette using Martingale is a bad idea

I've been leading unto this post for a bit now.

One of the most popular techniques in roulette is to use a progressive betting pattern such as

  • Martingale
  • Reverse Martingale
  • d'Alembert
  • etc
In all honesty, these are all a pile of rubbish.  If the math was corrupt, do you really think the casino's would let you play the game?   So the idea of this post is to let you see how much of a pile of rubbish they are.

So what is Martingale

The basic idea is that everytime you lose a bet, you double up your previous bet until you recoup your losses. Here is an example with a £10 stake and an initial bank of £10,000



Oh, wow, how amazing.  this must be free money.   Except, if you hit a long streak of losses the next stake is gonna exponentially grow.

And this is how much you'll have to bet to recover your losses during a losing streak



Oh wow after a losing streak of 11 losses, I'm betting £10,000 to recover my money.   Or 15 losses, I'm betting £163,000.   Get's pretty uncomfortable pretty quickly.

What else, can go wrong?  Well, even if you are stupid enough to try and bet £20,000 to recover your losses, the casino probably won't let you.  They have table limits (i.e. a maximum bet size).   And the chances are it's somewhere between £500 and £10,000.   

Yeah but i'll never get a streak that long

What's the chances of hitting a streak of 10 losses in a row and busting the table limits.   Errrr, pretty high.   See my post on streaky coin tosses (more favourable than red or black on roulette)



As you can see from the above graph (which is 20,000 simulated coin tosses).  You're gonna hit a streak of 10 or more, 18 times in 20,000 coin tosses.   In roulette this will work out basically around 1 in every 1,000 games.   That's pretty frequent.

Still don't believe me.

Try it yourself.   I've created a martingale simulator in excel.  Which uses my excel roulette simulator and an enhancement of my level staking plan simulators

The simulator allows you to simulate a large number of random roulette runs.   You can put in whatever table limits you want (it handles it) and you can generate new runs.



And as you can see in the above run, i bust out after about 1,000 games.   Sure i had a maximum bank of 3350 but i eventually bust out.

In-fact, you always bust out. 

Some people will say, ahhh but you play it until you win and then go home.   Sure but what happens the next night.....?    It's a small amount of games until you bust out.   You can't win.

Try it, play it in my simulator.   You can't win

Download my martingale simulator

You can download it from my dropbox for free.


Play with it until your heart is content.  (please note the simulator doesn't handle half-bet returns and doesn't need to the point is to show why martingale doesn't work)

You can even modify if you wan to try out your own wacky staking plans

So, next time you're tempted by playing martingale, just stop and think about it before you throw away your money

Hope this helps

Wednesday, 7 January 2015

Simulating Roulette in Excel

In one of my earlier posts, i showed you how to simulate a coin toss in excel (or google docs)

In this article, we will look at extending that technique to allow us to simulate roulette.   We're obviously just gonna randomly throw a roulette number and not simulate physics or mechanics (for now ;).   The idea is that you will be able to use this simulator to test out any crazy betting systems you may come up with.

This technique will work for both European and American wheels.   So let's get to it.

Setting up our wheel

First we want to do is setup our roulette wheel in Excel, and it should look something like this...



  • First column is a list of numbers from 0 to 36 (37 if you want to do an American Wheel)
  • Second column is the corresponding number on the roulette wheel (following actual layout)
  • Third column is the color of the number

So to set it up, do the following

1) Open Excel
2) Rename the tab to "European Wheel"
3) In the first row enter the headers (as shown in the screenshot): Number, Actual Number Color
4) In column A enter in each row the numbers 0 to 36
5) Enter the corresponding number in the roulette wheel in order in Column B
6) Enter the color of the actual number in Column C

European Wheel

The following table gives the layout of a European Wheel, you can just copy and past it into excel


Number Actual Number Color
0 0 Green
1 32 Red
2 15 Black
3 19 Red
4 4 Black
5 21 Red
6 2 Black
7 25 Red
8 17 Black
9 34 Red
10 6 Black
11 27 Red
12 13 Black
13 36 Red
14 11 Black
15 30 Red
16 8 Black
17 23 Red
18 10 Black
19 5 Red
20 24 Black
21 16 Red
22 33 Black
23 1 Red
24 20 Black
25 14 Red
26 31 Black
27 9 Red
28 22 Black
29 18 Red
30 29 Black
31 7 Red
32 28 Black
33 12 Red
34 35 Black
35 3 Red
36 26 Black



American Wheel

Setting up an American wheel is also pretty easy.  Just create a new table and name it "American Wheel" and set it up the same as a European wheel (0..37 though) and paste in the following layout


Number Actual Number Color
0 0 Green
1 28 Black
2 9 Red
3 26 Black
4 30 Red
5 11 Black
6 7 Red
7 20 Black
8 32 Red
9 17 Black
10 5 Red
11 22 Black
12 34 Red
13 15 Black
14 3 Red
15 24 Black
16 36 Red
17 13 Black
18 1 Red
19 00 Green
20 27 Red
21 10 Black
22 25 Red
23 29 Black
24 12 Red
25 8 Black
26 19 Red
27 31 Black
28 18 Red
29 6 Black
30 21 Red
31 33 Black
32 16 Red
33 4 Black
34 23 Red
35 35 Black
36 14 Red
37 2 Black

Setting up the random number generator

So we have our wheels setup, so we just need to setup our random number generator.   Which we want to look something like this



In this diagram:
  • Column A shows our randomly roulette number
  • Column B shows the color of the number corresponding to it's color on the European Wheel
This is pretty easy to setup
  • Manually enter the headers (Winning Number, Winning Color)
  • In row 2, enter the following formula in Column A
=VLOOKUP(RANDBETWEEN(0,36),'European Wheel'!$A$2:$A$38,1)

This basically generates a random number between 0 and 36 (RANDBETWEEN(0,36).   And then looks up the corresponding number on our European Wheel tab.   If we want to do this for an American Wheel, we would change the tab to American Wheel and set RANDBETWEEN to generate numbers between 0 and 37,
  • Enter the following formula in Row 2 of Column B
=VLOOKUP(A3,'European Wheel'!$A$2:$C$38,3)

This will look up the color of the generated number in our European Wheel (again if you want to simulate American Wheels then switch the tab to American Wheel.
  • Do the draggy extends paste thing to copy it to multiple rows

Voila, one very simple roulette simulator in Excel.

This is very simple and easily allows you test betting plans etc.   I use it for disproving systems such as martingale.   It usually proves it to fail pretty quickly.   I obviously have more advanced versions which can do billions of rows of testing but Excel isn't so suitable for that.    However this should be pretty suitable for your needs.

In a future post, i'll show you how to test staking plans such as Martingale and Reverse Martingale with the simulator.   So you can see for yourself how ridiculous these staking plans are.

Hope this helps

UPDATE

You can download a copy of my simulator from my dropbox

https://www.dropbox.com/s/3btgpurbtsuof50/Roulette%20Simulator.xlsx?dl=0



Tuesday, 6 January 2015

True odds vs Real Odds for Roulette

In my last post, we discussed how you calculate the probability of a single event.

In this post we'll show you how to convert that to odds and then compare the real odds to the probable odds.  In this example we'll look at Roulette.

Red or Black Probability

For now we'll focus on European Roulette (although the theory works just as well for American Roulette).    In the last post we calculated the probability for Red or Black to be 18/37.  In this example we'll bet Red.

There are 18 outcomes that can win for us (i.e. 18 reds), specifically the numbers

1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 35

And 19 outcomes that will lose for us

0, 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35

How to convert probability to Decimal Odds

The true probability for Red or Black is 18/37.  

To convert this to odds we need to do the following conversion

1 / probability

so for Red or Black this would be

1 / (18 / 37)

which would make the real odds

2.0556

The casino is offering odds of 2/1 which is equivalent in decimal odds of

2.0  (it's 2/1 ;)

What does this mean?

This means the casino is offering odds lower than the true probability of winning.   And the casino will profit on the game on average by 2.7% (I'm ignoring "en prison" for now).   Remember over a long period of time the actual results will be close enough to the real probability (see other posts).   So the casino can expect to make 2.7% on average for every game.

So if that roulette table stakes $100,000,000 per year.  Then that roulette table will be profiting by over $2,700,000

And this is how casinos make money.

The bad news is.......

If you play $100,000 worth of games on red or black.   you'll probably lose just over $2,700

We play 10,000 games with $10 stakes.

We win 4864 games (10,000 * (18/37)
We lose 5136 games (10,000 - 4864)

We win 4864 * 10 = $48,640
We lose 5136 * 10 = $51,360

In total we lose (£2,720), which the casinos bank as profit

The odds are in the casinos favor...

In future posts, we'll show:
  • Your bankroll degrading using an excel roulette simulator and how the casino's always win
  • A full post on odd conversions
  • How to manage books / be a bookie / be a casino
  • How fancy betting systems don't help when there is no advantage (Martingale, Reverse Martingale, Fibonacci, James Bond) - they'll all lose you money and we'll show it.
Hope this helps







Calculating Probability for single events

In the last post we figured out how to calculate the number of possible outcomes for coin tosses (or any game).  Now we'll look at the probability.

We can calculate the number of possible outcomes using the following formula

number of combinations ^ (number of tosses)

otherwise known as

number of combinations to the power of number of tosses.

So to calculate the probability of an event, we are basically saying the following

the number of times the desired outcome can occur / the number of possible outcomes

Coin Toss (2 sided coin)

So for a 2 sided coin (heads or tails).  there are 2 possible outcomes.

H, T

So there is 1 in 2 chance of flipping a head (as shown in blue below)

H, T

1 instance of the desired outcome within a set of 2 possible outcomes.  Giving a 1/2 chance (50% chance),

Coin Toss (3 sided coin)

So for a 2 sided coin (heads, tails or body).  there are 3 possible outcomes.

H, T, B

So there is 1 in 3 chance of flipping a head (as shown in blue below)

H, T, B

1 instance of the desired outcome within a set of 3 possible outcomes.  Giving a 1/3 chance (33.3333333% chance),

Dice Throw (6 sided dice)

So for a 6 sided dice throw there are 6 possible outcomes.

1,2,3,4,5,6

So there is 1 in 6 chance of rolling a 3 (as shown in blue below)

1,2,3,4,5,6

There is also a 1 in 6 (16.6666666%) chance of hitting any specific number

And there is a 3 in 6 (otherwise known as 1 in 2 (or 1/2 or 50%)) chance of hitting an even number

1,2,3,4,5,6

And the same for hitting an odd number

1,2,3,4,5,6

Specific Number in European and American Roulette

Now that we know how to calculate probability.  Let's look at roulette (we will have bigger discussions on this later).

However in European Roulette, we have the following numbers (note the number zero)

0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36

So in European Roulette, the probability of predicting a specific number is 1 in 37, i.e. 1 desired outcome in 37 possible outcomes (2.7% chance)

Specific Number in American Roulette

And in American Roulette, we have the following numbers (not the extra number, the double zero)

0,00,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36

So in American Roulette, the probability of predicting a specific number is 1 in 38, i.e. 1 desired outcome 38 possible outcomes (2.63% chance)

Red or Black in European Roulette

In European Roulette, the zero number is green.   And every other number (1 to 36) is evenly split between red and black (will explain the exact wheel in another post).   That means there are:

18 reds in 37 possible outcomes
18 blacks in 37 possible outcomes
1 zero (green) in 37 possible outcomes



Which means if you were to bet red or black, you would have an 18 in 37 (18/37 or 48.6% chance)

Red or Black in American Roulette

In American Roulette, the zero and double zero numbers are green.   And every other number (1 to 36) is evenly split between red and black (will explain the exact wheel in another post).   That means there are:

18 reds in 38 possible outcomes
18 blacks in 38 possible outcomes
2 zero numbers (green) in 38 possible outcomes



Which means if you were to bet red or black, you would have an 18 in 38 (18/38 or 47.36% chance)

Okay, so now you know how to calculate probabilities in single events.

In future posts, I'll discuss the following

  • Calculating Odds from Probabilities
  • How to make a book and calculating edge and over round
  • Calculating probabilities for sequenced events and multiple outcomes (double dice throws, lottery numbers etc).

Calculating the number of possible outcomes of a Coin Toss

In the previous posts, we've been concentrating a lot on coin tosses.

I thought it might be useful for us to look at how we can calculate the possible number of outcomes.  

In order to calculate the probability of an event to occur mathematically (or to be able to effectively analyze what happened, we need to be able to calculate all possible outcomes).

So in the case of a coin toss.   There are always two possible outcomes in a coin toss.   You will either flip heads or tails.   So let's look at how this breaks down for multiple coin tosses.

1 coin = 2 outcomes =  H,T
2 coins = 4 outcomes = HH,HT,
                       TH,TT
3 coins = 8 outcomes = HHH,HHT,HTH,HTT,
                       THH,THT,TTH,TTT
4 coins = 16 outcomes = HHHH,HHHT,HHTH,HHTT,HTHT,HTTH,HTTT,
                        THHH,THHT,THTH,THTT,TTHT,TTTH,TTTT

And so on and so forth.   And it grows quite quickly.   Here's how the growth looks charted in Excel.


Hey doesn't the graph look like the streaky graph we did the other day.  Sure it's a typical binomial distribution (we'll discuss that another day).  For now we'll concentrate on how to calculate on the number of outcomes for higher number ranges.

In our run of 39 coin tosses, it would probably take us a long time to figure out how many outcomes there were if we were to calculate each and every outcome.   So we wanna take a shortcut.

Inferring the number of outcomes for a coin toss

Just by looking at the coin toss data, we can probably infer that the number of outcomes doubles every time we add a coin.   2 outcomes, 4 outcomes, 8 outcomes, 16 outcomes...

And you'll probably notice the pattern as well.   If you look at 3 coin tosses,  you can see that the first line is the exact same sequence as 2 coin tosses except the first coin toss is a head.   And the second line is again the same sequence as 2 coin tosses but with a tail as the first coin toss.    So sure, it makes sense that it doubles up all the time.

So we are really number of combinations (heads or tails) * number of combinations for previous number of coins

1 coin = 2 outcomes
2 coins = 4 outcomes = 2 outcomes * 2 combinations
3 coins = 8 outcomes = 4 outcomes * 2 combinations
4 coins = 16 outcomes = 8 outcomes * 2 combinations

What would happen if we had a 3 sided coin

Let's say for a second our coin has 3 sides, (Heads, Tails and errrrr Body).  What would happen?

1 coin = 3 outcomes =    H, T, B
2 coins = 9 outcomes =   HH, HT, HB, 
                         TH, TT, TB, 
                         BH, BT, BB
3 coins = 27 outcomes =  HHH,HHT,HHB,HTH,HTT,HTB,HBH,HBT,HBB,
                         THH,THT,THB,TTH,TTT,TTB,TBH,TBT,TBB,
                         BHH,BHT,BHB,BTH,BTT,BTB,BBH,BBT,BBB

Okay, so now we seem to be tripling up from the previous set of outcomes.
And we're following the same pattern as before.
First line is the exact same sequence as 2 coin tosses except the first coin toss is a head.   And the second line is again the same sequence as 2 coin tosses but with a tail as the first coin toss.    And the third line is again the same sequence as 2 coin tosses but with a body as the first coin toss.  So sure, it makes sense that it triples up all the time.

So we are still number of combinations (heads, tails, body) * number of combinations for previous number of coins

1 coin = 3 outcomes
2 coins = 9 outcomes = 3 outcomes * 3 combinations
3 coins = 27 outcomes = 9 outcomes * 3 combinations
4 coins = 81 outcomes = 27 outcomes * 3 combinations

This is cool but would still be a pain to calculate 39 combinations.   What's the formula for doing this?

Quick way for calculating number of outcomes

The quick way of doing this is calculating this is 

number of combinations ^ (number of tosses)

otherwise known as 

number of combinations to the power of number of tosses.

So for a 3 sided coin with 2 tosses, we would calculate it as 

1 coin = 3^1 = 3 = 3 outcomes
2 coins = 3^2 = 3 * 3 = 9 outcomes
3 coins = 3^3 = 3 * 3 * 3 = 27 outcomes
4 coins = 3^4 = 3 * 3 * 3 * 3 = 81 outcomes

And for our regular 2 sided coin

1 coin = 2^1 = 2 = 2 outcomes
2 coins = 2^2 = 2 * 2 = 4 outcomes
3 coins = 2^3 = 2 * 2 * 2 = 8 outcomes
4 coins = 3^4 = 2 * 2 * 2 * 2 = 16 outcomes

How would we do this in Excel (or google docs)?
Pretty easy really.  Lets generate a table of coin tosses (2 sided coin) with their number of outcomes.  Something like this



To generate this in excel, we just do the following

1) In column A, just put the number of coin tosses to generate.  
2) In column B, just put in the following formula

=POWER(2,A2)

3) Do the cell draggy thing to generate the table.

And if you want, you can generate a chart like I did.

BTW, the answer is there is 549,755,813,888 (around 550 billion) possible outcomes for 39 coin tosses.

And if you don't believe me, try it yourself, you know how to check it now



Monday, 5 January 2015

How to calculate streaks in excel

So in my last post, i showed you how to look at streaks for coin tosses in Excel

In this post, i'll show you how i calculate the streaks in Excel (or google docs).   You can use the same technique to calculate streaks in anything (i.e. roulette).

What is a streak?

For coin tosses would be the same coin be thrown X times in a row.  e.g. 7 heads in a row would be a streak.

What does this look like in Excel?

First thing we need to do is track the length of a streak.   This is how it looks for me in Excel.



1) In the left hand column is the result of the coin toss (heads or tails),  you can generate this randomly using the technique described in my blog post, generating random coin tosses in excel

2) The right hand column tells the length of the streak.   As you can see in the image above, every time the streak ends, the count gets reset to 1.  If the latest coin toss is the same as the previous it increases

How do I calculate this in Excel (or google docs)?

I've used the following formula to calculate this.  I put this in each cell in the B column

=IF(A2=A1,B1+1,1)

Column A is the column with the result of the coin toss
Column B is the length of the streak.

This formula basically says, if the current coin toss is the same as the previous coin toss then increment the streak count by 1.   If the coin toss is different from the previous, reset the streak count to 1.

Summarizing the Data

Now that we've got the streaks.   We want a summary of the data.  This is how it looks in Excel



And this how we calculate it

1) Left column is a just count of the streaks (just enter 1 to 15)
2) Right column is calculated by the following formula

=COUNTIF(Sheet17!B2:B20001,A2)-B3

This formula counts up all the entries in the range that meet the IF condition.  In our case, we look at our 20,000 coin tosses that we've held in Sheet 17 in cells B2 to B20001.   The condition it needs to meet is the value in the A column (i.e. the length of the sequence, in this case A2).   So for row 10, it will count up all the sequences of length 9.     Now obviously a sequence of 9 will also count all the sequences of 10's.   So we subtract that number that's next in the sequence.   We don't want to count all the 10's in the 9 sequence count (that's the -B3 bit).

And then we can generate a chart against the distribution, i used a nice bar chart



Anyways, i hope this is useful.  This technique is pretty useful for predicting monte-carlo predictions of betting patterns and proving how bad things like martingale are.   And if you develop some advantage play system in blackjack, roulette, sports betting then this technique will allow you to calculate streaks.

Hope it helps.




Streaky coin tosses

In the previous post we looked at how the data distribution gets closer to the real probability as the number of samples increase.   And we showed this happened in our excel generated random coin tosses.   What we didn't look at was how streaky the coin tosses were?

A streak is considered as the same coin toss in a row i.e. Heads, Heads, Heads, Heads.   Would be a streak of 4 heads.

So what happened in our 20,000 coin tosses?



As we can see above, we get lots of long streaks.   Actually we get 14 tosses of the same side in a row.    That's quite a streak.   

And that curve looks quite appropriate.  It's a binomial distribution and one that looks like it should for a 50/50 probability.

At another time, we'll discuss binomial distributions and the probability of coin tosses.   But for now, lets just say, a streak of 14 is quite normal.   :)

Loss Recovery betting plans aren't looking so good now.

Do we really wanna talk about Martingale / loss recovery betting patterns?   Really?  Ummm ok, we can.   Are you sure you're expecting a black just because the last color was a red?   Are you sure you're owed a black.   Are you sure 10 reds in a row is unusual?  Looks pretty normal to me.


The more coin tosses we do, the closer we get to 50/50

So in the previous posts, we looked at how we can generate coin tosses in excel using a random number generator.

One of the things we noted is that although coin tosses have a 50/50 chance of being heads or tails, it doesn't work out that way in reality for small samples.  The following shows the distribution for one of our excel simulations (39 coin tosses)



This is what happens as we increase the number of tosses, here is 1000 tosses



And 5000 tosses




10,000 tosses


And 20,000 tosses



As we can see, the more tosses we do the closer we get to 50%, but ultimately it's still random, so we can still get a decent difference.

This tells us a few things:

  • Small samples aren't sufficient to predict trends or check randomness
  • The more samples we do the more likely we will get something that fits the probability
  • Random doesn't look random
  • Our coin tosses over a large number of samples fits the probability
In future posts we will check some of these simulations for betting patterns such as martingale, check probabilities of roulette tables etc etc

And of course, you can check all of this yourself using the techniques described in the earlier post.  You don't need to take my word for it.

What do random coin tosses look like?

In my last post, I showed you my attempt at faking 40 coin tosses.

Let's take a look at what happens if we generate the coin tosses in excel

Excel Generated Data Run 1

Here is the data

Tails,Heads,Tails,Heads,Heads,Heads
Heads,Heads,Tails,Tails,Tails,Tails
Tails,Tails,Heads,Tails,Heads,Tails
Tails,Tails,Tails,Tails,Heads,Heads
Heads,Tails,Tails,Heads,Tails,Tails
Heads,Heads,Heads,Heads,Heads,Heads
Tails,Tails,Heads

Fun facts about this data set.

  • Longest Tails Sequence is 6
  • Longest Heads sequence is 6
  • 44% Tails vs 56% Heads


And this distribution looks like this:


There are a few points to be noted on this:

  • Sequences are quite long (6), in the fake random data we only generated sequences of 3
  • The distribution is not 50%, more heads were generated (eventually over time, it'd be closer to 50-50, we'll prove this later

Excel Generated Data Run 2

Just for fun, i thought, i'd do another run and this is what it looked like

Tails,Heads,Heads,Tails,Heads
Tails,Tails,Heads,Heads,Tails
Tails,Tails,Tails,Tails,Tails
Tails,Tails,Tails,Tails,Heads
Heads,Tails,Heads,Tails,Tails
Heads,Heads,Heads,Tails,Tails
Heads,Heads,Tails,Heads,Tails
Tails,Heads,Tails,Tails

Fun facts about this data set.

  • Longest Tails Sequence is 10
  • Longest Heads sequence is 3
  • 62% Tails vs 38% Heads

And this distribution looked like this




Again the point is, with very small datasets, the data won't be evenly distributed 50/50.
Eventually over a large sample it will eventually become statistically correct.

As I said in a previous post.  Random data doesn't necessarily look like random data.

There are a few points to note though.

  • If I set my excel to say Red or Black (for roulette), how many of you would think that Black (tails) was a hot color?   
  • How many people would say after 6 tails, well we're due a head?
  • Do you really want to play a doubling up betting pattern such as martingale (discuss in a future post) when we have sequence of 10 tails.
We'll discuss a lot of these concepts later but it's thoughts to think about.

In the next couple of posts:

  • We'll look at generating longer sequences (and see the stats regress towards the mean (i.e. end up around 50%).
  • We'll also look at what happens with physical coin tosses
Don't worry, we'll get to roulette and other games.  But these concepts are important to understand before we get there and get blinded by the games.






Faking Randomness (badly) in a Coin Toss

In my last post, we looked at how you could use Excel to simulate a coin toss.

Before we look at that some more, I thought it might be fun for me to manually attempt to generate some random data for 40 coin tosses.   All I've done is this

1) Open Excel
2) In each cell, typed heads or tails
3) Rinse and repeat 40 times

I've tried to make this "random".   And here is the data below

Heads,Tails,Heads,Tails,Tails,Tails
Heads,Heads,Tails,Heads,Tails,Tails
Heads,Heads,Tails,Heads,Tails,Tails
Tails,Heads,Tails,Heads,Tails,Heads
Heads,Tails,Heads,Tails,Tails,Tails
Heads,Heads,Tails,Heads,Tails,Heads
Heads,Tails,Tails,Heads

Here is some fun facts about my random data, in my data the following coins were errrr thrown:

19 Heads (47.5%)
21 Tails (52.5%)

The longest sequence was 3 coins of the same type.  On 3 different occasions we "threw" tails 3 times.   The longest sequence we had for Heads was twice in a row.

Pretty random huh?

Actually, this data is pretty obviously made up as we will discover.

And in a later post, i think we can prove this by testing for randomness (p.s. i haven't tested this dataset but i'm pretty sure it'll flag it as fake but we'll see later).

The main reason it's obviously random is that it looks random.   Random data doesn't look random but non-random data does.  Counterintuitive, i know.

The reason this data looks random is the following:

  • The data is pretty evenly distributed (over a small sample) - 47.5% vs 52.5%
  • There are no long chains (the longest chain is 3)

Let's remember this when we look in our next set of posts, where we look at:

Real coin tosses and Excel generated coin tosses

Simulating a coin toss in excel

I guess when you start to look at gambling theories or probabilities the natural place to start is the coin toss.

This relates especially well to roulette as a Heads or Tails coin toss kinda relates to Red or Black (not quite because of those pesky zeroes and double zeroes (and some other mechanical factors)).

Although Excel won't produce necessarily a true random number (it's a pretty poor random number generator (will discuss in another article), for our sake it will do.

Generating a random number between two values

The first thing we need to do is get excel to generate a random number between 2 values.   One number to represent heads and another to represent tails.   In this case 0 and 1.   0 will represent Heads and 1 will represent tails.

To do this

1) Open Excel
2) Open a new Workbook
3) Click on any cell and in the formula bar type in the following function

=RANDBETWEEN(0,1)

And here is how this looks on my machine (I'm using excel on a Mac)
















As you can guess from the formula, it randomly produces a number between 0 and 1 which funnily enough would be the values 0 and 1.   

Making it say Heads or Tails

As you can guess from the formula, it randomly produces a number between 0 and 1 which funnily enough would be the values 0 and 1.   

It would be cooler if it said Heads or Tails rather than 1 or 0.   And it's pretty easy to do in Excel.   We'll just use the IF formula.

So in your cell, just replace the previous formula with this.

=IF(RANDBETWEEN(0,1) = 0,"Heads","Tails")

And this will now check the randomly generated number, and if it's 0, it will display Heads in the cell, and if it's 1, it will display 1.

And here is how this looks on my machine















Generating lots of numbers

So we've generated one simulated coin toss but we obviously want to generate lots of numbers.  So to do that all we need to do is grab our cell by the bottom right hand corner and drag down.

And now you can see below, i've generate 20 coin tosses using the above method.


























Pretty easy to do right.   And we can use this in the future do lots of things.   Pick cards randomly, perform probability calculations etc.  Test for yourself if magic betting systems such as martingale is a good idea (btw it's not).

Google Docs

And the exact same thing works in Google Docs.

Hope you found this useful