Hacker News new | past | comments | ask | show | jobs | submit login

Alternately, a protocol for getting a fair "d3" from a coin with any number of sides - flip three times. If all three results are the same or if all three are different, restart. If two are the same and one is different, the position of the odd one out gives your ultimate result.

For example it works for simulating a d3 using a two-sided coin: THH or HTT -> 1, HTH or THT -> 2, HHT or TTH -> 3, HHH or TTT -> reroll.

This can be combined with your protocol, but it takes some thought to interpret because in your protocol the result is what actually shows up on the coin, but in mine it's the position.




Aha, very nice. This is generalizable too: to get a fair dN from a randomization source with any number of unfair outcomes, do sets of N randomizations until you get a set that's exactly 1 of something and N-1 of something else, and the position of the unique one gives the ultimate result. (This requires N > 2, since for N=2 you can't tell which was the 1-of and which was the N-1.)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: