Re:How can a computer deal a poker hand?
by jcranmer on Saturday October 01, 2016 @03:39AM
(#12616928)
What you've described is essentially the Fisher-Yates shuffle implemented slowly (O(n²) implementation). The O(n) implementation would be:
Intuitively, what the latter implementation is doing is keeping the sorted_deck and shuffled_deck variables in the same array, moving the partition each iteration. The big problem with this method is that it is very easy to make a mistake in its implementation, and any slight mistake will lead to horribly biased outputs.
[ Parent
| on HN ]
There are no comments on this comment yet.