预览: TopdeckGo Github: TopdeckGo
private static final Double[] WEIGHTS = new Double[]{0.4,4.1,24.5,71.0};
private static final Integer[] ID = new Integer[]{LEGEND,EPIC,RARE,COMMON};
private static int randomChoice(){
double sumOfWeight = 0;
for (Double weight : WEIGHTS) {
sumOfWeight += weight;
}
Random random = new Random();
double randNumber = random.nextDouble()*sumOfWeight;
for (int i = 0; i < WEIGHTS.length; i++) {
if (randNumber<WEIGHTS[i]) return ID[i];
randNumber -= WEIGHTS[i];
}
return COMMON;
}
public static int[] getARandomSet(){
int[] sum = new int[5];
for (int i = 0; i < 5; i++) {
sum[randomChoice()]++;
}
return sum;
}
ps: 卡牌图片是外站的资源,所以会有某些卡牌图片缺失
1
yukiww233 2019-10-13 17:57:34 +08:00 2
在循环里使用时间做 seed 会导致大量重复
|
2
densuc 2019-10-13 20:50:01 +08:00
不能一张一张自己点开没有灵魂(大雾)
|
5
luhe 2019-10-13 21:54:47 +08:00
营地好像也有模拟开包
|
6
tearain 2019-10-13 23:25:30 +08:00
开了 5 包,在有基本卡的情况下都开了 2 橙 4 紫 4 蓝 9 白。。。然而再去游戏上一开,emmmm
|
7
zepto 2019-10-14 11:10:30 +08:00
5 包两橙怕不是托吧 哈哈
|
8
zw1one 2019-10-14 13:56:58 +08:00
没有酒馆老板音效差评!(狗头
|