top | item 42184405

(no title)

NameError | 1 year ago

Easy way to get a fair result from an unfair coin toss: Flip the coin twice in a row, in this case starting with the same side facing up both times, so it's equally unfair for both tosses. If you get heads-heads or tails-tails, discard and start over until you get either heads-tails or tails-heads, which have equal probabilities (so you can say something like HT = "heads" and TH = "tails").

This works even if the coin lands heads 99% of the time, as long as it's consistent (but you'll probably have to flip a bunch of times in that case).

discuss

order

simcop2387|1 year ago

If anyone wants to look up why this might work, it's a Whitening transform [0]. I can't find the name of the algorithm itself being describe in the parent but there's more than just that for accomplishing the same thing.

0: https://en.wikipedia.org/wiki/Whitening_transformation

npsomaratna|1 year ago

Thank you. This was useful to learn.

aidenn0|1 year ago

That's Von Neumann Whitening.

legobmw99|1 year ago

I’ve seen this attributed to John von Neumann, of all people

NameError|1 year ago

It seems like he did everything! I first heard of Von Neumann in international relations & economics classes as the person who established game theory, then later in CS classes as the creator of mergesort, cellular automata, Von Neumann architecture, etc.

mankyd|1 year ago

Importantly - you don't have to know the odds of the coin ahead of time, or which side is more likely. You only need to know that it is consistent.

IncreasePosts|1 year ago

The odds are important to know because if someone gave you a trick coin that always lands on heads, you will be flipping coins until the end of the universe. And I'm sure you have more important things to do than that.

ant6n|1 year ago

What if consecutive unfair coin flips are not independent?

FartyMcFarter|1 year ago

Then it's impossible to trust the coin in the general case.

Proof: Imagine the extreme case of the coin containing AI that knows exactly how you use it and how to manipulate each toss result. The coin itself can decide the outcome of your procedure, so it's impossible to trust it to generate randomness.

Aloisius|1 year ago

Each flip would need to start with the same side up though, if this paper is correct.