Created
May 17, 2015 00:11
-
-
Save uzimith/42cc06776ad04d735798 to your computer and use it in GitHub Desktop.
swift random
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
//: Playground - noun: a place where people can play | |
import UIKit | |
var array = [1,2,3,4,5,6] | |
for i in 0..<10 { | |
if (array.isEmpty) { | |
array = [1,2,3,4,5,6] | |
} | |
var index = Int(arc4random() % UInt32(array.count)) | |
NSLog("%d",array[index]) | |
array.removeAtIndex(index) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment