The Almighty Card Shuffling Algorithm
So this pops up from time to time, we spent a long time sorting out shuffle algorithms early on in the development process for Untap.in.
The following is a basic explanation for whats happening when you shuffle your deck:
We take the smallest number that doesn't divide into the amount of cards in a deck (IE 7 for a 60 card deck), and simulate a pile shuffle to break apart the cards from the initial deck order (starting from a pseudo random card). From there we have a new deck order, but it's not randomized (yet). This step might be redundant, but we do it since its a common shuffle for IRL play, and its handy to start in an order that isn't deck build order.
Now, the actual shuffle algorithm.