mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-10 13:37:01 +03:00
Merge pull request #100 from ajayyy/experimental
Fix weight not updating properly
This commit is contained in:
@@ -43,6 +43,7 @@ function getWeightedRandomChoice(choices, amountOfChoices) {
|
|||||||
|
|
||||||
//add it to the chosen ones and remove it from the choices before the next iteration
|
//add it to the chosen ones and remove it from the choices before the next iteration
|
||||||
chosen.push(choices[i]);
|
chosen.push(choices[i]);
|
||||||
|
totalWeight -= choices[i].weight;
|
||||||
choices.splice(i, 1);
|
choices.splice(i, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user