实验过程
let arr=[],num=[]
for(let i=1;i<=7;i++){
for(let j=1;j<=7;j++){
for(let z=1;z<=7;z++){
for(let a=1;a<=7;a++){
for(let b=1;b<=7;b++){
let res =i+j+z+a+b
res=res%10
arr.push(res)
}
}
}
}
}
运行结果
image.png
统计输出
for(let index=0;index<=10;index++){
num[index] = arr.filter(i=>i==index)
}
统计结果
image.png
由此可得
rand10=(rand7+rand7+rand7+rand7+rand7+...+rand7)%10
rand7执行次数越多,越接近平均分布