diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/js/index.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/js/index.js b/src/js/index.js index dbbd382..f354399 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -846,9 +846,13 @@ | |||
846 | // eg the second last card can be only one of two, not one of fifty two | 846 | // eg the second last card can be only one of two, not one of fifty two |
847 | // so the added entropy for that card is only one bit at most | 847 | // so the added entropy for that card is only one bit at most |
848 | if (entropy.base.asInt == 52) { | 848 | if (entropy.base.asInt == 52) { |
849 | var totalCombos = factorial(52); | 849 | var totalDecks = Math.ceil(entropy.base.parts.length / 52); |
850 | var remainingCards = 52 - entropy.base.parts.length; | 850 | var totalCards = totalDecks * 52; |
851 | var remainingCombos = factorial(remainingCards); | 851 | var totalCombos = factorial(52).pow(totalDecks); |
852 | var totalRemainingCards = totalCards - entropy.base.parts.length; | ||
853 | var remainingDecks = Math.floor(totalRemainingCards / 52); | ||
854 | var remainingCards = totalRemainingCards % 52; | ||
855 | var remainingCombos = factorial(52).pow(remainingDecks) * factorial(remainingCards); | ||
852 | var currentCombos = totalCombos.divide(remainingCombos); | 856 | var currentCombos = totalCombos.divide(remainingCombos); |
853 | bitsStr = currentCombos.toString(2).length.toString(); | 857 | bitsStr = currentCombos.toString(2).length.toString(); |
854 | } | 858 | } |