# Coin Flip Percentages

## Recommended Posts

you have

`heads = heads++;`

if you do heads++ don't do the "heads =" part. it should be just

`heads++;`

should work with that change. I didn't catch that the first time through.

Edited by flareback

##### Share on other sites

Thanks, that fixed it.

##### Share on other sites
no it's actually ok with the <= 5 because that only applies to .500000000000000000 nothing bigger. granted < 5 would be better, but <+ doesn't really skew the results

Um no it's not okay, you're skewing the results. (I'm not sure how you come to the conclusion that you're NOT skewing them, to be honest.) Heads and tails should have an equal chance to show up, <= 0.5 means that one has a higher chance of showing than the other, which is inaccurate. It's pretty basic maths. For it to be even you'd need:

0.5000 - 0.9999 = tails

This way, each side has 5000 possible ways to win, instead of your suggested approach which would give heads 5001 ways to win and tails 4999 ways to win. 5001/4999 != 50/50.

Edited by gnack

##### Share on other sites
This way, each side has 5000 possible ways to win, instead of your suggested approach which would give heads 5001 ways to win and tails 4999 ways to win. 5001/4999 != 50/50.

Old thread and I don't think it really matters anyway! He was flipping coins, not deciding the faith of the universe