While understanding the how/why of algorithms is great, a word of advice: If this were a real project and your standard library has a shuffle() function, just use that one and get on with life.<p>Save yourself from having to worry about your hand-crafted one being subtly wrong. Save your peers from having to debug your hand-crafted one years after you've left the company. This tip goes for basically any routine that already comes built-into your language or libraries. Spend your time writing code that doesn't already exist. I'm looking at you, co-worker from 5 or so years ago who felt he had to re-implement strings, linked lists, and sorting.