Simulating deck-shuffling
I recently worked on a small project simulating random events that were far too numerous to enumerate. In such cases, every bit of speed matters.
The project in this case was similar to determining likelihood of five-card Poker hands in seven-card draws.
Simulation of shuffling the deck and drawing cards can take a large part of the runtime if not done well, but there's a trick that makes it almost trivial.
Continue reading "Simulating deck-shuffling"