We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bda00a9 commit 5c6a07fCopy full SHA for 5c6a07f
index.js
@@ -50,7 +50,10 @@ generateRandomCardButton.addEventListener("click", () => {
50
: card.rarity === "legendary"
51
? 0.025
52
: 0; //add card weight to weight sum
53
- if (number <= weightSum && cards.length > 0) {
+ if (
54
+ number <= totalWeight ||
55
+ (number <= weightSum && cards.length > 0)
56
+ ) {
57
//if random number is less than or equal to weight sum
58
randomCardOutput.innerText = `You got a ${card.rarity} card: ${card.name}`; //display generated random card
59
return; //exit function
0 commit comments