Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's not what the parent meant. You shuffle the array with e.g. Fisher-Yates and then create a permutation from the shuffled array. That always gives a permutation that has one cycle. What you did was create a permutation from the original and the shuffled variant which has the problems you describe...


Thanks for clarifying. I was on my cell phone and was very brief.


Ah, you're right! My mistake.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: