How It Works: The Fisher-Yates Shuffle
This simulator uses the Fisher-Yates shuffle algorithm (also known as the Knuth shuffle) to generate a truly random permutation of the cards. The algorithm works by iterating through the array of cards from the end to the beginning.
In each step, it picks a random card from the unshuffled part of the deck and swaps it with the current card. This ensures that every card has an equal probability of ending up in any position, resulting in a perfectly shuffled deck.