I Hand Shuffling reliable? If you are thinking this question, or you like card games, it is good for you to read this post.

## Hand Shuffling

Originally, the hand shuffling has three steps.

- Split the cards into two separated parts.
- Merge these two parts, one card by one card. If these two parts have different numbers of cards, leave the extra cards on the top.
- Repeat the steps above, for several times.

## How to evaluate

To evaluate the simulation, I set the number of cards to 52. Thus, we exclude the jokers. At the beginning, the cards are ordered in the same way. Then we shuffle them several times, and record the position of each card. The testing will repeat thousands of time. Ideally, one card will locate at every position with equal probabilities. Standard Deviation will be used to measure how the shuffling algorithm works.

## Cases

The section will discuss cases in the testing. By the way, when merging the cards, which hand will act first randomly.

### Can’t evenly divide into two parts.

We assump that the difference between two sets of cards is no more than 10. Then we get a chart showing how the Standard Deviation performs with the shuffling times,

Actually, the result is bad. The cards have not been shuffled. The first half of cards are intend to stay at the same position. The worst thing is the more times you shuffle, the less shuffled it will be…

### Divide them evenly

This time, the play is getting better. And he/she is capable to divide the cards evenly. The result is much better. When the player shuffles more than 7 (The number is given by a magician, while it can be seen from the chart above), the cards seem like shuffled.

The figure above indicates the possibilities for each card at each position. A deeper red indicates more possibility.

## How to be a good shuffler?

Suppose that you use the hand shuffling algorithm described above, here are two suggestions,

- Divide cards evenly before merge them.
- Shuffle cards more than 7 times.

By the way, in computer science, we don’t use this algorithm. Here is Fisher-Yates Shuffle, while it is difficult to implement when playing cards with friends.

Thanks so much to both of you.