Simulating a fair die with a 5-card hand This question is inspired by an earlier post: Card game and dice rolling: Finding random variables with similar probability mass function
I want to simulate a fair 6-sided die using 5-card hands from a regular deck of 52 cards.  Cards are drawn without replacement, so there are ${52 \choose 5}$ possible hands, and since this number is divisible by 6, it is possible to partition the ${52 \choose 5}$ possible hands into 6 equal-sized disjoint subsets $A_1 \cup A_2 \cup A_3 \cup A_4 \cup A_5 \cup A_6$.  Then, when I draw a 5-card hand, if it belongs to $A_j$ then I pretend I rolled the number $j$, and this process simulates a fair 6-sided die.  This is entirely possible, but my question is: What is the easiest / most elegant / simplest way to do this?
If the order of drawing the 5 cards can be used (which is the question asked by the earlier post), then an easy / elegant / simple answer is: $A_1 = $ the first non-King you draw is Ace or 2, $A_2 =$ the first non-King you draw is 3 or 4, etc., up to $A_6=$ the first non-King you draw is Jack or Queen.  These sets are clearly of equal size and disjoint, and since you draw 5 cards you must draw a non-King, so their union also cover all $52 \times 51 \times 50 \times 49 \times 48$ possible draws.  However, this method requires that you distinguish based on the order of drawing those 5 cards.  My question in this post requires that you do not distinguish based on the order of draw.
@RossMillikan and I had a brief discussion of several attempted solutions in the comments of the earlier post, but now that I have more time to think, I think none of the solutions actually work.  Here are the (IMHO wrong) attempts:


*

*1st Attempt: Ignore Kings, assign Ace = 1; 2 through 10 = face value; J = 11; Q = 12.  Add the 5 card values mod 6.  


*

*My thoughts: This would have obviously worked if you were drawing with replacement (and can somehow "magically" avoid the 5-King draw), since every card is uniformly distributed mod 6.  But because you are drawing without replacement, if your first card is e.g. a 4, then the next card is no longer randomly distributed mod 6 because you have one fewer 4.  Maybe this still simulates a fair die, but I don't see an obvious proof.


*2nd Attempt: Again ignore kings (until the end). If you have distinct ranks, add them mod 6. If you have at least one pair, take the rank with maximum quantity (most repeated occurrences) mod 6. This handles all draws except $xxyyz$ and $Kxxyy$. For the first, take $z$ mod 6. For the second, if the king is red take the higher rank of $x$ or $y$, if the king is black take the lower.


*

*My thoughts: This would obviously work if each subcase is partitioned evenly into the 6 subsets.  E.g. all hands of type $xxyyz$ certainly seems to be partitioned evenly.  However consider hands of type $KKKxy$ (3 Kings, 2 other different ranks).  Because we're constrained by $x \neq y$ (in this subcase), $Prob(x+y \ is\ odd) = 6/11$.  So clearly this subcase is not partitioned evenly into the 6 subsets.  Again, the overall scheme might still simulate a fair die, but I don't see an obvious proof.



To summarize: the question is not whether this partition is possible - it is, simply because ${52 \choose 5}$ is divisible by 6.  The question is what is an easy / elegant / simple way to do this, i.e. to describe the partition.
(Bonus if your solution generalizes to any $N$-sided die, where $N$ divides ${52 \choose 5}$.)
 A: Let the ranks be $0,\ldots, 12$ instead of weird symbols.
If one or more ranks occur exactly twice, pick the highest such rank and convert its suit patterns (there are $4\choose 2$ possibilities) into the result.
For the rest, we assume that no rank occurs exactly twice. We will obtain a random number mod 3 from the ranks only and a mod 2 random number from the suits only, which are independent. For the latter, simply check if there are more black or more red cards.
The consideration of the ranks is a bit more complicated:


*

*If one rank $a$  occurs four times and another rank $b$ once, then $(b-a)\bmod 13$ is uniformly distributed $\in\{1,\ldots,12\}$ and we are done

*If one rank $a$  occurs three times and other rank $b,c$ once, then check if $a$ is the smallest, the middle, or the highest of these ranks


Remains the case that five ranks occur exactly once. In that case, mark these ranks on a clock face (ignoring rank $0$ if it occurs as a clock face has no $0$). We obtain a 4- or 5-gon; note that the 5gon cannot be regular.


*

*If the polygon has a unique longest edge, pick the clockwise first vertex of that edge.

*else if there is a unique shortest edge, pick the clockwise first vertex of that edge

*else if the polygon has exactly one vertex that is common to two longest edges take that vertex

*else if the polygon has exactly one vertex that is common to two shortest edges take that vertex

*else we  must have a 4gon that is a rectangle (possibly a square). Pick the clockwise first point of any of its longest edges (the difference does not matter mod 3)

A: Treating the cards as values in $\{1,2,\dots,52\}$ by any method, take the sum of your cards modulo $6$.

The result is uniform, but not obviously so. I originally proved this by brute-force computation. Here is a computer-free argument, though it does require some casework and doesn't generalize too well.
First, we partition the cards into $\{1,2,\dots,48\}$ and $\{49,50,51,52\}$, and consider each possibility for how many cards are drawn from the first set and how many from the second. In each case, the distribution of the sum modulo $6$ will be uniform.
For random $k$-element subsets of $\{1,2,\dots,48\}$, we have:


*

*the sum is uniform modulo $2$ for $k=1,3,5$.

*the sum is uniform modulo $3$ for $k=1,2,4,5$.

*the sum modulo $3$ is independent from the sum modulo $2$.


The first few facts can be verified by partitioning the subsets into cycles $S,S+1,S+2,\dots,S+47$, where $S+i$ represents a cyclic shift of all the elements of $S$ by $i$. Since $S+48=S$, we return to the start after $48$ steps, though sometimes we return sooner. However, the sum of $S+1$ is $k$ more than the sum of $i$, so on each cycle, the sum is uniform modulo $2$ unless $2 \mid k$, and it's uniform modulo $3$ unless $3 \mid k$.
The sum modulo $2$ is independent from the sum modulo $3$ because, for each card, its value modulo $2$ is independent from its value modulo $3$.
Now we can handle each case of drawing $k$ cards from $\{1,2,\dots,48\}$ and $5-k$ from $\{49,50,51,52\}$ separately. The cases are very similar. For example, here's the $k=3$ case.
For $k=3$, we have uniformity modulo $2$ but not modulo $3$, so the frequencies of the sum modulo $6$ for the cards drawn from $\{1,2,\dots,48\}$ are $(a,b,c,a,b,c)$ for some $a,b,c$. The probabilities of each sum modulo $6$ for the two cards drawn from $\{49,50,51,52\}$ are $\frac16, \frac16, 0, \frac16, \frac16, \frac13$.
Combining these in all possible ways, we conclude that the frequencies for the total sum modulo $6$ are $(2a+2b+2c, 2a+2b+2c, 2a+2b+2c,2a+2b+2c,2a+2b+2c,2a+2b+2c)$, which is uniform.

Generalizations: this approach shows that whenever $n \equiv 4 \pmod 6$, we can draw $5$ cards from $\{1,2,\dots,n\}$ and get a uniform total modulo $6$. The case $n \equiv 0 \pmod 6$ works too, and is even easier to prove: we just don't set aside $4$ cards.
Whenever $p$ is a prime and $k<p$, the sum of $k$ cards is uniform modulo $p$ in all the cases when $\binom{n}{k}$ is divisible by $p$. In this case, the argument above is very easy to conduct: we split this up into drawing $i$ cards from $\{1,2,\dots, p\lfloor \frac np\rfloor\}$ and $k-i$ from the remainder. The only case which isn't automatically uniform is the case $i=0$, and $\binom nk$ is divisible by $p$ precisely when that case is impossible (because there are fewer than $k$ cards in the remainder).
