var nz = 0; var nfc = 0; var nf = 0; var nharf = 0; var nMax = document.getElementById("n1000").value; var nM500 = document.getElementById("n500").value; var nRepeat = document.getElementById("ntotal").value;
for (j = 0; j < nRepeat; j++) { //重复的轮数(一万轮)
nz = 0;//正面数 nfz = 0;//反常数,不记数 nf = 0;//反面数
for (i = 0; i < nMax; i++) { //抛1000次硬币 var rm = Math.random() * 10;//得到0到10之间的随机数(含小数点) var rm0 = Math.floor(rm);//转换成0到9之间的正数(不含小数点),即:0,1,2,3,4,5,6,7,8,9