public Integer getPrizeResult() {
// 10W内的随机数
try {
while (true) {
int index = new Random().nextInt(100001);
log.info("【随机数】"+index);
if (0 < index && index <= 20) {
log.info("恭喜获得一等奖");
} else if (20 < index && index <= 220) {
log.info("恭喜获得二等奖");
}else if (220 < index && index <= 2220) {
log.info("恭喜获得三等奖");
}else if (2220 < index && index <= 17220) {
log.info("恭喜获得四等奖");
}else if (17220 < index && index <= 100000) {
log.info("感谢参与");
}
}
} catch (Exception e) {
log.info("【抽奖】" + e);
}
}
简单的抽奖随机策略
最新推荐文章于 2022-09-06 13:29:03 发布