public static void main(String[] args) {
ArrayList<Integer> integers = new ArrayList<>();
int giftpercent=0;
int[] ints = new int[8];
ints[0]=50;
ints[1]=10;
ints[2]=10;
ints[3]=5;
ints[4]=5;
ints[5]=5;
ints[6]=5;
ints[7]=10;
int x=0;
for (int i :ints) {
x +=i;
integers.add(x);
}
if(integers.get(7) !=100){
LogUtils.log("转盘概率设置错误,请联系管理员");
}
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
int f = 0;
int g = 0;
int h = 0;
int total = 0;
for (int i = 0; i < 10000; i++) {
total++;
int r = (int) (Math.random() * 100000) % 100;
if(r <=integers.get(0)){
a++;
LogUtils.log("---------------第1个数据");
}else if(r>integers.get(0) && r <=integers.get(1)){
b++;
LogUtils.log("---------------第2个数据");
}else if(r>integers.get(1) && r <=integers.get(2)){
c++;
LogUtils.log("---------------第3个数据");
} else if(r>integers.get(2) && r <=integers.get(3)){
d++;
LogUtils.log("---------------第4个数据");
}else if(r>integers.get(3) && r <=integers.get(4)){
e++;
LogUtils.log("---------------第5个数据");
}else if(r>integers.get(4) && r <=integers.get(5)){
f++;
LogUtils.log("---------------第6个数据");
}else if(r>integers.get(5) && r <=integers.get(6)){
g++;
LogUtils.log("---------------第7个数据");
}else if(r>integers.get(6) && r <=integers.get(7)){
h++;
LogUtils.log("---------------第8个数据");
}else {
LogUtils.log("未知中奖等级");
}
}
LogUtils.log("中奖概率:a:"+(float)a/(float)total);
LogUtils.log("中奖概率:b:"+(float)b/(float)total);
LogUtils.log("中奖概率:c:"+(float)c/(float)total);
LogUtils.log("中奖概率:d:"+(float)d/(float)total);
LogUtils.log("中奖概率:e:"+(float)e/(float)total);
LogUtils.log("中奖概率:f:"+(float)f/(float)total);
LogUtils.log("中奖概率:g:"+(float)g/(float)total);
LogUtils.log("中奖概率:h:"+(float)h/(float)total);
}