From b6dd109fcb604981e60efb58187bdaf6359c9804 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Thu, 23 Jul 2020 23:34:31 -0400 Subject: [PATCH] Fix weight not properly --- src/routes/getSkipSegments.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/getSkipSegments.js b/src/routes/getSkipSegments.js index c156fa4..fc9eb69 100644 --- a/src/routes/getSkipSegments.js +++ b/src/routes/getSkipSegments.js @@ -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); }