by VWWHFSfQ · 6y ago · 0 comments
It's clearly not independent though, but this calculation remains true if you assume only that not having a nuclear war doesn't change the odds for future years, even if having one does.
function calc30(odds) {
for (let i = 0; i < 30; i++) {
if (Math.random() < odds) return true;
}
return false;
}
Array.from(Array(10000)).map(() => calc30(0.04)).filter(Boolean).length //=> 7022 or ~70%
Array.from(Array(10000)).map(() => calc30(0.02)).filter(Boolean).length //=> 4545 or ~45%