How to simulate a deck of cards in Minecraft?

A dispenser can eject one of nine different items at random, simulating a deck of up to nine cards (as of 1.6 it is no longer biased toward certain slots). How would you simulate a deck of cards with more?

Note:

• A dice-type random generator isn't sufficient, since it doesn't simulate a card being removed from the deck on subsequent draws
• It would be beneficial to simulate arbitrary decks, not just a standard deck of playing cards
-

To simulate a standard 52-card deck, you need to go through a number of steps:

• Stage 1 - Suit selector
A dispenser containing 4 stacks of 13, corresponding to each deck. The item dispensed tells you what deck to go to for the next stage.
• Stage 2 - High/Low
We can't proceed directly to choosing a card, since we don't have 13 slots in a dispenser, so insert a high/low selector here. This is another dispenser with 2 stacks, one of 6 and one of 7. 6 -> low, 7 -> high. You need one of each of these dispensers for each deck.
• Stage 3 - Card selector
Finally, you can set up your final array of dispensers, containing the cards, 6 for low, 7 for high, again two dispensers for each deck. These dispensers only contain 6/7 unique items that correspond to the cards.

To use the card selector, first use the deck selector. It will pop out an item corresponding to which deck you should use. Keep this item!. Next, use the high/low selector for the deck you have been assigned. Again, keep the item!. Finally, remove your 'card' from the deck at the last round.

This method will simulate removing cards from the deck, as long as you don't take a wrong path (i.e. you are assigned spades at stage 1 and then go on to use the diamonds stage 2).

It is not perfect, since the odds at stage 2 are weighted in favour of high cards. There's no way round this (using dispensers) since 13 is a prime number.

As you can see, this method can be adapted to model non-standard decks.

-