I'm writing a blackjack game, and just finished setting up my card and deck representations. Because Clojure doesn't have a deterministic shuffle function, I ended up piggy-backing onto Java's shuffle, but I'm concerned about the results.
Many of the test decks I've generated and shuffled contain 3+ consecutive numbers, so I'm wondering if this is to be expected, or if I should force it to shuffle the decks more than once.
An example with 3:
2 A K 3 9 J 3 8 8 6 Q 4 A 4 K J 9 5 3 8 5 J 2 4 7 K 6 8 9 2 5 4 9 A Q 2 Q 6 7 10 10 7 5 7 Q J 3 K 10 10 6 A
No, I'm not falling for the same thinking as Apple shuffle users. I know that in a perfectly random pick of values from a list with repeats, I'll expect that I may have consecutive draws.
I'm wondering though, in a shuffled deck, how many consecutive pairs should I expect? If most of my shuffled decks end up having 3+ consecutive pairs, does that suggest that the shuffling algorithm is flawed?
This has been asked before, but it didn't get any results, so I figured I'd ask again.
java.util.Collections/shufflemethod, so it depends on that. If may vary by collection type for all I know. – Carcigenicate Oct 03 '16 at 17:26