月初的时候和朋友一起讨论了下卡池的期望抽数,当时简单用NodeJs模拟了一下,现在有空了所以优化一下。下面是各类卡池的模拟平均抽数,基于1000000000
(10亿)次抽卡模拟重复五次,以获取其期望抽数。
下列代码你可以直接在浏览器里DevTools里执行,也可以在NodeJs里面npm i rlog-js
后运行
获得任意6星
六星概率: 2%,50抽以上每抽增加2%概率 即:0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
for (let i = 0; i < repeat; i++) {
let progress = 0, count = 0, pureCount = 0, result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
result.push(count);
pureCount = count = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i+1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:",average);
[1]OK: 34.59529592539372
[2]OK: 34.5991310082256
[3]OK: 34.59073060431148
[4]OK: 34.588859350387324
[5]OK: 34.591771606859396
DONE: 34.5931576990355
双UP池
UP的两个占六星出率的50%
获取任一当期UP
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
for (let i = 0; i < repeat; i++) {
let progress = 0, count = 0, pureCount = 0, result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
if (Gacha(0.5)) {
result.push(count);
count = 0;
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i+1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 69.1749551521472
[2]OK: 69.194680479032
[3]OK: 69.17733825110419
[4]OK: 69.17497429285018
[5]OK: 69.20638888467883
DONE: 69.18566741196248
获取指定当期UP
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
for (let i = 0; i < repeat; i++) {
let progress = 0, count = 0, pureCount = 0, result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
if (Gacha(0.25)) {
result.push(count);
count = 0;
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i+1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 138.3733520598603
[2]OK: 138.38325186250017
[3]OK: 138.32609380667049
[4]OK: 138.3889013208252
[5]OK: 138.3787517766102
DONE: 138.37007016529327
两个当期UP都抽到
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
let goodsList = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
if (Gacha(0.5)) {
let good = Gacha(0.5) ? "A" : "B";
if (!goodsList.includes(good) && goodsList.length !== 0) {
result.push(count);
count = 0;
goodsList = [];
} else {
goodsList.push(good);
}
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 207.49862687783664
[2]OK: 207.5666340787051
[3]OK: 207.54910040955664
[4]OK: 207.54194993548558
[5]OK: 207.6427050445757
DONE: 207.55980326923196
满潜指定UP
敢这么做的都是真正的勇士,向他们致敬
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
let goodsList = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
let good = Gacha(0.25) ? "A" : "other";
if (good === "A" && goodsList.filter(item => item === "A").length >= 5) {
result.push(count);
count = 0;
goodsList = [];
} else {
goodsList.push(good);
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 830.566163731169
[2]OK: 830.224143914374
[3]OK: 830.06150755771
[4]OK: 830.3241004061115
[5]OK: 830.5730621899886
DONE: 830.3497955598707
单UP池
获取当期UP
因为出率也是0.02*0.5
,所以跟上面的#获取任一当期UP是一样的。
[1]OK: 69.1749551521472
[2]OK: 69.194680479032
[3]OK: 69.17733825110419
[4]OK: 69.17497429285018
[5]OK: 69.20638888467883
DONE: 69.18566741196248
当期UP满潜(6次)
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
let goodsList = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
let good = Gacha(0.5) ? "A" : "other";
if (good === "A" && goodsList.filter(item => item === "A").length >= 5) {
result.push(count);
count = 0;
goodsList = [];
} else {
goodsList.push(good);
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 415.0445342785281
[2]OK: 415.1437808970759
[3]OK: 415.1019054422766
[4]OK: 415.12086036289037
[5]OK: 415.003539980196
DONE: 415.08292419219345
联动池
获取联动UP
不考虑120抽送一个的情况下,获取当期UP和上面单UP的#获取当期UP是一样的
考虑120抽送一个
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
if (Gacha(0.5)) {
result.push(count);
count = 0;
}
pureCount = 0;
}
if (count == 120) {
result.push(count);
count = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 59.26944131024346
[2]OK: 59.2876330029115
[3]OK: 59.27903650225231
[4]OK: 59.285805247078336
[5]OK: 59.27721981777353
DONE: 59.279827176051825
联动满潜
不考虑120抽送一个
不考虑的话跟上面#当期UP满潜(6次)是一样的
考虑120抽送一个
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
let goodsList = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
let good = Gacha(0.5) ? "A" : "other";
if (good === "A" && goodsList.filter(item => item === "A").length >= 5) {
result.push(count);
count = 0;
goodsList = [];
} else {
goodsList.push(good);
}
pureCount = 0;
}
if (count == 120) {
goodsList.push("A");
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 346.6247759070824
[2]OK: 346.5902966501008
[3]OK: 346.54573606660887
[4]OK: 346.60339075165103
[5]OK: 346.71839705150677
DONE: 346.61651928539
前路回想/定向甄选(3up)
获取指定UP(1/3)
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
for (let i = 0; i < repeat; i++) {
let progress = 0, count = 0, pureCount = 0, result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
if (Gacha(0.33333333333333333333)) {
result.push(count);
count = 0;
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i+1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 103.77826569705941
[2]OK: 103.78772255590552
[3]OK: 103.7550401604634
[4]OK: 103.76091824262208
[5]OK: 103.79829085734275
DONE: 103.77604750267865
联合行动(4up)
获取指定UP(1/4)
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
if (Gacha(0.25)) {
result.push(count);
count = 0;
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 138.36548301453004
[2]OK: 138.33629303832288
[3]OK: 138.41343872686213
[4]OK: 138.3623815929329
[5]OK: 138.26359179499602
DONE: 138.34823763352878
限定池
UP的两个占六星出率的70%
获取任一当期UP(2)
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
for (let i = 0; i < repeat; i++) {
let progress = 0, count = 0, pureCount = 0, result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
if (Gacha(0.7)) {
result.push(count);
count = 0;
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i+1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 49.415093306567485
[2]OK: 49.422466356026696
[3]OK: 49.420820111822515
[4]OK: 49.41645833923242
[5]OK: 49.42174580537875
DONE: 49.41931678380557
获取指定当期UP(2)
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
for (let i = 0; i < repeat; i++) {
let progress = 0, count = 0, pureCount = 0, result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
if (Gacha(0.35)) {
result.push(count);
count = 0;
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i+1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 98.83522685155444
[2]OK: 98.8520215880953
[3]OK: 98.88017216224536
[4]OK: 98.82947359765672
[5]OK: 98.88619533880141
DONE: 98.85661790767065
两个当期UP都抽到(2)
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
let goodsList = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
if (Gacha(0.7)) {
let good = Gacha(0.5) ? "A" : "B";
if (!goodsList.includes(good) && goodsList.length !== 0) {
result.push(count);
count = 0;
goodsList = [];
} else {
goodsList.push(good);
}
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 148.2569357930345
[2]OK: 148.25190251666498
[3]OK: 148.27962274698382
[4]OK: 148.2629366084023
[5]OK: 148.25403447410366
DONE: 148.26108642783788
当期限定满潜
不考虑300抽必送
此处"不考虑300抽必送"的概率也可视作"当期陪跑满潜"的概率
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
let goodsList = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
let good = Gacha(0.35) ? "A" : "other";
if (good === "A" && goodsList.filter(item => item === "A").length >= 5) {
result.push(count);
count = 0;
goodsList = [];
} else {
goodsList.push(good);
}
pureCount = 0;
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 593.342225555487
[2]OK: 592.9808852611636
[3]OK: 593.1423256873334
[4]OK: 593.1254389128248
[5]OK: 593.0375025055835
DONE: 593.1256755844785
考虑300抽必送
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
let goodsList = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
let good = Gacha(0.35) ? "A" : "other";
if (good === "A" && goodsList.filter(item => item === "A").length >= 5) {
result.push(count);
count = 0;
goodsList = [];
} else {
goodsList.push(good);
}
pureCount = 0;
}
if (count == 300) {
goodsList.push("A");
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 508.9542872527818
[2]OK: 509.08565162454323
[3]OK: 509.18415459645627
[4]OK: 509.06699219803926
[5]OK: 508.97138410187165
DONE: 509.05249395473845
300抽必送+300抽换一个
const rlog =
typeof window !== "undefined" ? console : new (require("rlog-js"))();
rlog.progress = rlog == console ? () => {} : rlog.progress;
const Gacha = (probability) => Math.random() < probability;
const num = 1000000000;
const repeat = 5;
let resultAll = [];
let goodsList = [];
for (let i = 0; i < repeat; i++) {
let progress = 0,
count = 0,
pureCount = 0,
result = [];
while (progress < num) {
rlog.progress(++progress, num);
count++;
pureCount++;
if (Gacha(0.02 * (pureCount <= 50 ? 1 : 1 + pureCount - 50))) {
let good = Gacha(0.35) ? "A" : "other";
if (good === "A" && goodsList.filter(item => item === "A").length >= 5) {
result.push(count);
count = 0;
goodsList = [];
} else {
goodsList.push(good);
}
pureCount = 0;
}
if (count == 300) {
goodsList.push("A");
goodsList.push("A");
}
}
resultAll.push(num / result.length);
rlog.log(`[${i + 1}]OK:`, num / result.length);
}
let average = resultAll.reduce((sum, val) => sum + val, 0) / resultAll.length;
rlog.log("DONE:", average);
[1]OK: 442.897256694392
[2]OK: 442.6847234814143
[3]OK: 442.7954740989001
[4]OK: 442.7688104794522
[5]OK: 442.80331695108663
DONE: 442.78991634104904