Java获取随机数参考链接:https://www.cnblogs.com/uncle-box/p/5918743.html
https://m.jb51.net/article/96990.htm
package 课后作业1;
public class SuiJiShu {
public static void main(String[] args) {
int face;
int f[] =
new int[6
];
int lucky;
for(
int i = 0; i <6; i++
) {
f[i]=0
;
}
for(
int i = 1; i <= 6000; i++
) {
lucky=(
int)(Math.random()*6
);
f[lucky]++
;
}
System.out.println("Face Frequency"
);
for(face = 0; face < 6; face++
) {
System.out.println((face+1)+":"+
f[face]);
}
}
}
模仿骰子,将六面体骰子掷6000次,统计出各面出现的次数
转载于:https://www.cnblogs.com/zzstdruan1707-4/p/9801299.html
相关资源:数据结构—成绩单生成器