Skip to content

Instantly share code, notes, and snippets.

@songtianyi
Last active July 13, 2020 11:32
Show Gist options
  • Save songtianyi/857acad648d654f6c84d783f296dd896 to your computer and use it in GitHub Desktop.
Save songtianyi/857acad648d654f6c84d783f296dd896 to your computer and use it in GitHub Desktop.
cards shuffle algorithm
START WITH FRESH DECK
GET RANDOM SEED
FOR CT = 1, WHILE CT <= 52, DO
X = RANDOM NUMBER BETWEEN CT AND 52 INCLUSIVE
SWAP DECK[CT] WITH DECK[X]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment