Created
June 3, 2015 10:22
-
-
Save alketii/b0715d961dc66550955a to your computer and use it in GitHub Desktop.
array 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
func shuffle(array): | |
randomize() | |
var shuffeled = [] | |
var current | |
var count = array.size() | |
for i in range(0,count): | |
current = randi()%array.size() | |
shuffeled.append(array[current]) | |
array.remove(current) | |
return shuffeled |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment