3 ms·
The method I described it a bit weird and round-about, exactly because it has to work around not knowing the bias. Essentially, it generates a thousand flips,
by eru 5y ago
The method I described it a bit weird and round-about, exactly because it has to work around not knowing the bias.
Essentially, it generates a thousand flips, and then carefully extracts the randomness only out of how those flips are shuffled, but now how many heads there are.
However, the closer to 500/500 your distribution is, the more entropy the method I describes can extract. Conversely, if you randomly hit 1000 heads and 0 tails, the method can't extract anything, and you'll have to sample again.
In contrast, a method that knows the bias and can exploit it, can extract the same number of random bits, no matter what you actually flipped. Eg in the special case of a known unbiased coin, you always get 1000 random bits for 1000 flips. Even if those flips happen to be 1000 heads.
- SilasX 5y agoBut the point remains, your method shouldn’t need a full table cached in advance, right? You should be able to use a formula to compute its “effective index”.
- eru 5y agoYes, definitely. I just didn't mention that, because I thought it was obvious that we agree on that. And instead of computing the "effective index" as an abstract number and then extract bits from that, you can work out directly how to generate the unbiased bits.