Time to roll some private keys

I'm not sure the best way to show it, or where I originally read it. But it is a mathematical proof.

(In the following, H=1 and T=0)

Imagine a coin that will always land on heads. It's 100% weighted. And another coin that is truly 50-50. If you XOR those two flips together, you will have the possible results of H+T=H or H+H=T, each with a 50% probability. So the result is a 50-50 even though the one input was always heads.

Now let's weight it so it's 90% heads and 10% tails.

Well 90% of the time, the situation is the same, H+H=T and H+T=H, each with a 50% chance. But as those outcomes only represent 90% of the possibilities, we know that each of them only happens 0.9*0.5 = 45% of the time.

The other 10% of the time, the first coin is T, so the results are T+T=T (because 0+0=0), and T+H=H, and each of those outcomes still has a 50% chance, but within the context of already starting at a 10% chance, the overall probability is 0.1*0.5 = 5% for each.

So when we map out all possibilities of things that can happen, we arrive at the following probabilities and their outcomes:

45%  H+H = T
45%  H+T = H
5%   T+T = T
5%   T+H = H

That represents 100% of the possible outcomes, and if you add the probabilities together for how often H is the result and how often T is the results, you will get 45+5 = 50% for each, a true 50-50.

From that, we can see that no matter how the first coin is weighted, the XOR result will always be 50-50 because the second coin is fair. Further, we can then say because we know that result is 50-50, if we XOR it with any other coin, we can guarantee that the result of that new operation will also be 50-50.

And we extrapolate that forward until we've XOR'd all the coins together and we can now prove that as long as one of them was fair, the final result will be 50-50.

Now we can also extrapolate that out to other types of data. After all, if a series of 1's and 0's (heads and tails) XOR'd with another series is 1's and 0's is completely fair, then that means that data, represented by 1's and 0's, can also undergo that same transformation, and as long as one of those pieces of data is "truly random", then the XOR'd result is also just as random, as we just showed with the weighted coin flips.

So that's how and why companies that want true randomness will gather multiple sources of randomness... they'll have their Geiger counter and their cosmic background radiation radio and their noise gatherer and their sha256 and whatever else, and then they'll XOR it all together, and that way, they get the best entropy of all the sources, even if they don't know which source actually has the best entropy. So whenever you hear somebody talk about combining sources of randomness, that's what they mean, they're just XORing the sources together, because that gives them the best possible randomness.

/r/Bitcoin Thread Link - imgur.com