Skip to content

Commit

Permalink
forgot loop
Browse files Browse the repository at this point in the history
  • Loading branch information
retraigo committed Nov 13, 2022
1 parent 7b12ed7 commit 67a4680
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/fortuna.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ export class GachaMachine<T> {
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) {
Expand Down

0 comments on commit 67a4680

Please sign in to comment.