Hacker News new | ask | show | jobs
by evantbyrne 193 days ago
If you have a coin: Heads and tails represent bits. Flip a coin three times and add up the result to emulate a six-sided dice roll. e.g., heads, heads, tails = 3. If you get 7, then try again.
1 comments

If you get all heads or all tails then use the last toss as part of your next set of 3.

E.g. HHHHT -> HHT -> 6

Ah yeah of course, there is a zero case as well. I was thinking you just restart as to not bias the result. That's an interesting alternative though
That will make HHH always 6 and TTT always 1
HHH becomes H

Then depending on the next 2 throws

HH -> keep going

HT -> 6

TH -> 5

TT -> 4

For TTT similar with K,1,2,3