As of Swift 1.2, Apple introduces Set collection type.
Set
Say, I have a set like:
var set = Set(arrayLiteral: 1, 2, 3, 4, 5)
extension Set { func randomElement() -> Element? { return count == 0 ? nil : self[advance(self.startIndex, Int(arc4random()) % count)] } }