The Coin Flip: A Fundamentally Unfair Proposition? (2009)
econ.ucsb.edu
econ.ucsb.edu
1. Toss the coin twice. 2. If the results match, start over, forgetting both results. 3. If the results differ, use the first result, forgetting the second.
This has appeared on HN before, but no one's pointed it out so far in the discussion. More info: https://en.wikipedia.org/wiki/Fair_coin#Fair_results_from_a_...
Assume p is the probability of flipping heads. Then, pp is the probability of flipping 2 heads, (1-p)(1-p) is the probability of flipping 2 tails, (1-p)p is the probability of flipping tails then heads, and p(1-p) is the probability of flipping heads then tails.
So, basically p^2 + (1-p)^2 + p(1-p) + (1-p)p = 1.
Then, we ignore the first 2 terms (since that's when the results match and we start over), and we're only left with the p(1-p) case and the (1-p)p case. These are equally likely, and the first coin is heads in the first case and tails in the second.
[javascript]
var sim = () =>{
var percentChanceOfHeads = 99;
var getRandomArbitrary = (min, max) => {
return Math.random() * (max - min) + min;
};
let heads = 0, tails = 0;
for (let i = 0; i < 100000; i++){
var test1 = getRandomArbitrary(0,100);
var test2 = getRandomArbitrary(0,100);
if (test1 > percentChanceOfHeads && test2 > percentChanceOfHeads) continue;
if (test1 <= percentChanceOfHeads && test2 <= percentChanceOfHeads) continue;
if (test1 <= percentChanceOfHeads) heads++;
else tails++;
}
let total = heads + tails;
let heads2 = 0, tails2 = 0;
for (let i = 0; i < total; i++){
var test1 = getRandomArbitrary(0,100);
if (test1 <= 50) heads2++;
else tails2++;
}
var distanceClosed = Math.abs(heads-tails) - Math.abs(heads2-tails2);
return distanceClosed;
};
for(let i=0;i<10000;i++)temp.push(sim()); console.log('avg variance:' + temp.reduce((a,c)=>a+c)/10000); chanceOfHead=0.9;
heads=0;
tails=0;
flips=0;
while(flips<1000)
{
coin1=Math.random()<chanceOfHead;
coin2=Math.random()<chanceOfHead;
if(coin1==coin2) continue;
heads+=coin1;
tails+=coin2;
flips++;
};
console.log(heads,tails);It's also interesting (and I guess should be obvious) to note that the "thrown out" tosses seem to be a pretty consistent ratio based on the "biased-ness" of the coin.
edit: no, got confused with something else (game I used to play was subject to widespread paranoia about the dice including the RNG source and whether other players had hacks. The dev ended up jumping thru all sorts of hoops to satisfy people -- taking random.org, letting each client add their own modifier and then using VN)
I think the straightforward way to extend VN is rolling 6 dice and reroll all if there are any duplicates, then use the first one (or whatever). Probably more efficient to turn the die into a coin and then use a few coins to approximate the die.
(1, 2, 5, 6) -> heads
(3, 4) -> tails
And use Neumann's algo.
You could bound the time if you knew the exact distribution though. Not sure if there's a method that's guaranteed to meet this bound.
The set of p for which there is a method to do it in finitely many flips is quite interesting though. It is bigger than the irrational numbers (it contains sqrt(1/2)), but smaller than all algebraic numbers. At the very least you'd need 1/2 ∈ Z[p], but that might not be enough.
This doesn't make sense, because they started counting the number of heads from when the coin is launched. But the first state (actually the first few states) are irrelevant, because you always wait a second or two before catching the coin. If you follow this line of reasoning, then the state after the customary delay is the one that has the higher probability. But that state is fair (50/50) and, because the customary period varies, not determined by the initial state.
On a tangential note, this behavior reminds me of Benford's law, which is probably based on other statistical reasoning.
For convenience, let's assume that the coin spins at 2 seconds per revolution. The coin begins in a Heads up position. After 0.5 a second, the coin is on its edge. The coin then takes another second to pass through Tails and again be on its edge. The coin then takes another 0.5 a second to reach its initial state of Heads up.
So it sounds to me like the coin spent 0.5 a second in "Heads", then 1 second in "Tails", then 0.5 a second in "Heads" before starting all over again.
If I borrow the numbering analogy from the article, it sounds like if we examine the coin in 0.5 second increments we get H T T H H T T H H T T H H, etc. which invalidates the article's claim.
Furthermore, the article claims a 51-49 split between sides. Even if we accept its reasoning (i.e. H T H T instead of H T T H H T T H) To get that specific result, (if my math is right) the coin would have to flip around 25 times on average (i.e H T H T H T H T H T H T H T H T H T H T H T H T 0.5*H), which is a specific number not mentioned in the linked article.
All of that to say that I have no intention of refuting the paper behind the article, nor do I think they are wrong, but just that the logic presented by the article (and not the paper which I didn't read!) sounds too simplistic to be correct to me.
Imagine a counter ticking 1,2,3,4...
If you call stop at a random time, uniform over the whole tick time, there's a bias toward odds.
But if you choose to call stop at moment 20.5 (and stopping at a fractional time forces the system to round to the nearest whole number), plus random variation due to real-world physics, evens and odds are equally likely.
Edit : Basically, unless you start the coin in the vertical state, the odds-and-even comparison doesn't apply.
Edit: Actually, 21 out of the 27 flips were in the 0.5 - .505 range.
I'm pretty sure the article is wrong. Hold on while I write a little script to test this out.
Edit: Script below; feel free to critique or make modifications where you think they are more realistic.
// Let 1 represent heads and 0 represent tails. coin_state = 1;
number_of_heads = 0;
number_of_tails = 0;
for (i = 0; i < 1000000; i++)
{
// How fast the coin flips (flips per second)
flip_speed = (Math.random() * 10) + 20;
// How long the coin is in the air (seconds)
catch_time = Math.random() + 2.5;
number_of_flips = Math.floor(flip_speed * catch_time);
/* Odd number of flips means coin ends up in opposite state from start (tails in this case). Even number of flips means coin ends up in same state as start (heads in this case) */
if (number_of_flips % 2) { coin_state = 0; }
if (number_of_flips % 2 == 0) { number_of_heads++; }
else { number_of_tails++; }
}
console.log("Heads:", number_of_heads);
console.log("Tails:", number_of_tails);
number 1 2 3 4 5 6 7 8 9
odd 1 1 2 2 3 3 4 4 5
even 0 1 1 2 2 3 3 4 4
difference 1 0 1 0 1 0 1 0 1
However, what happens here is different - you start at "half a state", meaning that the graph is a see-saw, as such: rotations 0.0 0.25 0.50 0.75 1.00 1.25 1.50
head 0.0 0.25 0.25 0.25 0.5 0.75 0.75
tail 0.0 0.0 0.25 0.5 0.5 0.5 0.75
difference 0 .25 0 -.25 0 .25 0Hence if you agree to a coin flip that someone proposes, you have already lowered your chances of a favourable outcome for yourself.
That's an exceedingly optimistic view of casinos. Slot machines have a far higher edge than 1%, generally in the range of 3-15%.
A slot machine is basically a money-making skinner box.
Blackjack with basic strategy (no card counting, just some 0 memory rules that would fit on a 3x5 card) is a narrow edge for the house, as is craps.
Some time ago, I remember reading a talk given by a Las Vegas casino operator during a conference on risk. They analyzed their top ten largest losses for the previous year, and found none of them were associated with their gambling results. The events that actually cost them were completely unrelated occurrences, like their resident entertainer getting savaged by a tiger, large fines from the gambling commission because of an incompetent employee, and so on. The gambling side of the business generated remarkably smooth results.
(Look on page six, where it breaks down the 'win percent', or the house edge, by the stake size)
I can time a coin catch to get 75-25 heads.
Don’t let someone catch the coin if they flip it.
https://bar-tricks.wonderhowto.com/news/win-coin-toss-every-...
If you're doing the same throw and the same catch each time, it just becomes muscle memory (again, like playing an instrument) and you can get a good success rate.
It seems that in any case the coin does spend more time statistically on the face that it was initially flipped from, but it's not exactly (num_rotations/2)+1
All fair coin tosses should land on a flat surface. Felt or carpet is better than tile because it reduces the odds of the coin spinning when it lands, which is weight-biased.
Maybe he already knows.
EDIT: https://www.patspulpit.com/2017/2/7/14522972/patriots-captai...
It sounds like it's been Slater making the all on his own but you never know....
http://www.stat.columbia.edu/~gelman/research/published/dice...
The OP is about empirically observed real-world tosses.
If the thing is tossed but stays in its initial state, is that a coin toss? What if you didn't hold it either H or T up? It's not impossible to hold it sideways and throw it up.
It can be considered a game of skill but any one player can turn it into a game of pure chance if he wants to, as such, is can be considered fairer.
The reason why RPS can become a came of chance is that there is no way to gain advantage over a player who plays randomly with equal probability : the outcome will be 50/50 no matter what. In game theory, it's called a Nash equilibrium.
Of course, if the opponent is playing sub-optimally (i.e. not randomly), you can try to take advantage of it.
Humans vary in reaction time and processing speed. I wonder if there are any humans faster enough than average to be able to cheat that way?
Professional baseball players might be good candidates to try to train to cheat at RPS. They have to be among the fastest humans at processing input and reacting in order to hit major league fastballs.
http://www.nytimes.com/interactive/science/rock-paper-scisso...
It's from the Ishikawa Watanabe Laboratory [0] at the University of Tokyo. They have a lot of cool research with high speed (1 kHz) video systems.
Table tennis is similar because you read the spin based off of the position of their paddle hitting the ball (table tennis balls are typically unmarked so reading the spin directly is a no-go).
OTOH, the table tennis stroke is more similar to a baseball bunt than a baseball swing as the paddle spends more time in a position overlapping the predicted path of the ball. This is somewhat negated by the much shorter distances in table tennis. It's hard to say which requires more quick reaction to complicated inputs.
You can look for external sources in order to increase your entropy, like the seconds hand of a clock.
You can get additional numbers or limit your bias by mentally running a PRNG. A lagged Fibonacci generator is a good candidate for this.
Otherwise, you are right, you simply cannot mentally generate good enough random numbers.
If you are on a Unix or Unix-like system, you could make a list with something like this (line wrapped for presentation):
xxd -p -l 5 /dev/urandom |
tr [a-f] [A-F] |
sed -e 's/./c&dlfx0=rd1-lfx0=pd2-lfx0=s/g' |
dc -e '16i[d3-d3-d3-d3-****]sf[[rock]psd]sr[[paper]psd]sp[[scissors]psd]ss' -
which gives something like: rock
scissors
rock
scissors
paper
scissors
scissors
scissors
paper
To memorize your list for the day, probably some kind of system where you have several images associated with each of rock, paper, scissors, and then use some standard memory technique, like a mind palace, to remember an image sequence for your particular list.If you don't want to be memorizing something new each day, it would probably work to just memorize one reasonably long sequence and just cycle through it. Assuming we are talking about casual RPS here, not people who compete in RPS tournaments, your opponents probably are not going to notice that you have a pattern.
For instance, if you happen to have memorized pi to more than the average person, you could step through the digits of pi, taking each digit mod 3 to get your choice (skip the digit 0). I don't know pi very far, just 3.141592653589793238462643383, but that would give me 7 days of 4 plays per day before repeating. For things like RPS to decide who drives to lunch at work and things like that, that would probably be good enough to not have anyone notice the pattern (well...unless someone else at work was also doing pi...).
Need a random number generator or other computerized solution to create 'fair' 50/50 odds
I would not consider that little game to be even or fair...I've learned a few tricks such that, best out of 3, I can nearly always win.
On a related note, it's much harder to fake randomness over time:
> [...] an automated "coin-flipper" device capable of flipping a coin and producing Heads 100% of the time.
A coin with rounded edges won't land on its edge 1 out of 6000 tosses. A coin with a flat edge that is thicker than either of its faces (or just thick in general; doesn't have to be thicker than the faces) will land on its edge a great deal more often.
Also, a coin with a heavier "tails" side will more often land on heads in a spin.
I guess I should read the paper. Maybe it clarifies.
Nevermind, found a link that talked about the paper. They used a US 5¢ coin, a nickel which has a flat edge and I think the thickest edge out of all (common?) US coins. At least it has the thickest edge to face ratio in terms of width.