Created
November 23, 2015 17:57
-
-
Save Renari/5c5137dc8f5b9d9c2a10 to your computer and use it in GitHub Desktop.
python shuffle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
def shuffle(deck): | |
for i in range(0, len(deck)): | |
temp = deck[len(deck)-(i+1)] | |
rand = randint(0, len(deck)-(i+1)) | |
deck[len(deck)-(i+1)] = deck[rand] | |
list[rand] = temp | |
return deck | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment