Merge pull request #100 from ajayyy/experimental

Fix weight not updating properly
This commit is contained in:
Ajay Ramachandran
2020-07-23 23:36:04 -04:00
committed by GitHub

View File

@@ -43,6 +43,7 @@ function getWeightedRandomChoice(choices, amountOfChoices) {
//add it to the chosen ones and remove it from the choices before the next iteration
chosen.push(choices[i]);
totalWeight -= choices[i].weight;
choices.splice(i, 1);
}