3 ms·
My point was the algorithm, not the implementation, hence my disclaimer on 'good randomness'.
by eximius 11y ago
My point was the algorithm, not the implementation, hence my disclaimer on 'good randomness'.
- astrodust 11y agoThe algorithm is not the problem. The "good randomness" part is the entire problem. Easy way to shuffle a deck is just to give each card a random 32-bit index and sort. You don't need to do anything fancy to get them shuffled up. The problem is, if your random number generator is predictable then the algorithm doesn't matter.
- AndrewStephens 11y agoEven that is very slightly biased, since you don't specify what happens when 2 cards accidentally end up with the same index. It's better to do the shuffle described in the document. It is not just the predictability of the generator that is the issue (all PRNG are predictable really), what really matters is the size of the seed state, which should vastly exceed the number of value shuffles (52! - a huge number).