Wow. I took this to the nth degree to convince a colleague. Very little variance between biased and unbiased figures:
[javascript]
var sim = () =>{
var percentChanceOfHeads = 99;
var getRandomArbitrary = (min, max) => {
return Math.random() * (max - min) + min;
};
let heads = 0, tails = 0;
for (let i = 0; i < 100000; i++){
var test1 = getRandomArbitrary(0,100);
var test2 = getRandomArbitrary(0,100);
if (test1 > percentChanceOfHeads && test2 > percentChanceOfHeads) continue;
if (test1 <= percentChanceOfHeads && test2 <= percentChanceOfHeads) continue;
if (test1 <= percentChanceOfHeads) heads++;
else tails++;
}
let total = heads + tails;
let heads2 = 0, tails2 = 0;
for (let i = 0; i < total; i++){
var test1 = getRandomArbitrary(0,100);
if (test1 <= 50) heads2++;
else tails2++;
}
var distanceClosed = Math.abs(heads-tails) - Math.abs(heads2-tails2);
return distanceClosed;
};
for(let i=0;i<10000;i++)temp.push(sim()); console.log('avg variance:' + temp.reduce((a,c)=>a+c)/10000);