Card Deck Simulation



How many cards in each suit?

This program shows how two arrays can together represent something like a deck of cards. One array holds face values. The other array holds suit information. When we use the deck, to get a single "card" we have to use one slot in both arrays.

For example, to get the 5th card in the deck, we look in slot 4 (remember, arrays start at slot 0) in both face and suit:

   card 5 is found using both face[4] and suit[4]

For input, the user tells how many cards to put in each suit (assuming th standard 4 suits).

The program ends on its own after creating a deck in order, and then shuffling the deck randomly.

If you edit the code, you can call the knuthShuffleDeck() function instead of the shuffleDeck() function and compare the apparent randomness of these two slightly different approaches to shuffling.