From 3386e7f2305cf95babbcd0aed514e32535794864 Mon Sep 17 00:00:00 2001 From: Nero Ignis Date: Thu, 3 Sep 2020 21:18:58 +0200 Subject: [PATCH] Fix card-sorting; --- js/CardDeck.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/js/CardDeck.js b/js/CardDeck.js index fd95a3b..cb00e02 100644 --- a/js/CardDeck.js +++ b/js/CardDeck.js @@ -60,12 +60,7 @@ class CardDeck { let cardCount = this.cards.length, t, i; for (let run = 0; run === runs; run++) { - while (cardCount) { - i = Math.floor(Math.random() * cardCount--); - t = this.cards[cardCount]; - this.cards[cardCount] = this.cards[i]; - this.cards[i] = t; - } + this.cards.sort( () => Math.random() - 0.5); } }