crobertsbmw / deckofcards

An API to simulate a deck of cards
MIT License
1.34k stars 335 forks source link

Remaining cards appears wrong after drawing cards #131

Closed nightwolfdev closed 1 year ago

nightwolfdev commented 1 year ago

I took the following steps:

  1. Visit https://www.deckofcardsapi.com/api/deck/new/shuffle and make note of the deck_id.
  2. Visit https://www.deckofcardsapi.com/api/deck/<>/draw/?count=2, replacing <<deck_id>> with the id from step 1. Make note that the remaining count is now 50.
  3. Visit https://www.deckofcardsapi.com/api/deck/<>/draw/?count=2, replacing <<deck_id>> with the id from step 1. Make note that the remaining count is now 48.
  4. Ask a friend to visit https://www.deckofcardsapi.com/api/deck/<>/draw/?count=2, replacing <<deck_id>> with the id from step 1. The remaining count was not 46? It was a lower number as if someone else had already drawn more cards.

Is the deck_id truly unique or is it being reused at any point?

Thanks for a great API. I look forward to using it to make some card type games!

crobertsbmw commented 1 year ago

The deck_is is just a random 12 letters and digits, but that's 4.7×10^18 combinations, so it's very very unlikely that someone else stumbled upon your deck_id. How did you send the link to your friend? Did you text or email it to them? I wonder if maybe the message client is previewing the URL causing the cards to be drawn in the background.

Thanks, Chase

On Tue, Jul 11, 2023 at 3:09 PM NightWolf Software Development < @.***> wrote:

I took the following steps:

  1. Visit https://www.deckofcardsapi.com/api/deck/new/shuffle and make note of the deck_id.
  2. Visit https://www.deckofcardsapi.com/api/deck/<>/draw/?count=2, replacing <> with the id from step 1. Make note that the remaining count is now 50.
  3. Visit https://www.deckofcardsapi.com/api/deck/<>/draw/?count=2, replacing <> with the id from step 1. Make note that the remaining count is now 48.
  4. Ask a friend to visit https://www.deckofcardsapi.com/api/deck/<>/draw/?count=2, replacing <> with the id from step 1. The remaining count was not 46? It was a lower number as if someone else had already drawn more cards.

Is the deck_id truly unique or is it being reused at any point?

Thanks for a great API. I look forward to using it to make some card type games!

— Reply to this email directly, view it on GitHub https://github.com/crobertsbmw/deckofcards/issues/131, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMQLHTR44ZTVKSFSBIC4ODXPW6JJANCNFSM6AAAAAA2GSEO3Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

nightwolfdev commented 1 year ago

I was using Google Chat. It appears that was the issue! When I didn't include the exact url and instead had my friend enter the deck id manually into the address bar, the remaining count appeared as expected. Thanks!