for(var i = 0, cnt = 0, all = 0; i < 10000; i++) { var v = Math.floor(Math.random() * 3) + 1; if (v == 1) cnt++ all++ if (v == 1) console.log(all % 2 ? "2は死刑" : "3は死刑") if (v == 2) console.log("3は死刑") if (v == 3) console.log("2は死刑") } alert(cnt / all)