for some reason those numbers are not adding up to me. do the chances compound year-over-year? how is the 4% any different in year 1 than in year 30? or any year in between? how does this add up to 70% over a 30 year period
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%