I just recently found out something that should've been head-slappingly obvious. It's kind of embarrassing. Here is some code that I thought scrambled an array with every possible scrambling equally likely:
For every item in your array,
swap this item with a random element in the array
For each element in your array, there are N ways that the
(
Read more... )
Comments 1
Which is to say they're ridiculously hard at first, but, then, looking back, stupid easy.
Reply
Leave a comment