← Questions
Shuffle an array with a random-integer function
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Using only a function that returns a uniform random integer in a range, shuffle an array (for example a deck of cards) so every permutation is equally likely. Implement Fisher-Yates, explain why it is uniform, and why a naive swap-with-any-position version is not.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
