From 67a46802b8b6c5fa96c55df0336a6d18db6bdcee Mon Sep 17 00:00:00 2001 From: Neko Of The Abyss Date: Sun, 13 Nov 2022 17:44:24 +0530 Subject: [PATCH] forgot loop --- src/fortuna.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fortuna.ts b/src/fortuna.ts index 4730633..5e984e5 100644 --- a/src/fortuna.ts +++ b/src/fortuna.ts @@ -66,9 +66,12 @@ export class GachaMachine { let i = 0; if (distinct) { const data = this.#items.slice(0); - const res = rollWithBinarySearch(data, totalChance); - result[i] = data[res].result; - data.splice(res, 1); + while (i < count) { + const res = rollWithBinarySearch(data, totalChance); + result[i] = data[res].result; + data.splice(res, 1); + i += 1; + } } else { const data = this.#items; while (i < count) {