3 ms·
That is amazing! super biased coin and it works! var h = 0; var t = 0; for(i = 0; i < 1000; i++) { var a = Math.random() < .1; var b = Math.random() < .1; if(a
by darkmarmot 9y ago
That is amazing! super biased coin and it works! var h = 0; var t = 0; for(i = 0; i < 1000; i++) { var a = Math.random() < .1; var b = Math.random() < .1; if(a !== b) { if(a){ h++} else {t++}} }; console.log(h,t);
- contravariant 9y agoYou could also just note that the two possible results where both coins differ are equally likely.