Hacker News new | ask | show | jobs
by Someone 2000 days ago
Fair, but only over time, and not truly random.

Only over time: this doesn’t help if you need _one_ fair flip.

Not random: for any 2 flips in sequence, you want a probability of ¼ to get two heads. This gets you either 70% × 30% or 30% × 70%, both of which are 0.21. That’s only 84% of the expected 0.25. In general, longer sequences of heads or tails are too rare with this method (e.g. for four flips: 70% × 30% × 70% × 30% is 0.0441; only 70.56% of the expected 0.0625. The probability of 6 consecutive heads or tails is less than 60% of what it should be, etc.)

1 comments

Good point about it not being random over sequences. Would be fun to find a method that would obey more constraints and requires fewer flips than TH, HT from the other comment.
As https://news.ycombinator.com/item?id=25531532 said look up arithmetic coding (https://en.wikipedia.org/wiki/Arithmetic_coding)

It’s not 100% the same, but understanding it should enable you to use the same idea for this problem.