import func Darwin.arc4random_uniform

extension Array {

    func shuffle() -> Array {

        var result = self; result.shuffleInPlace(); return result
    }

    mutating func shuffleInPlace() {

        for i in 1 ..< count { swap(&self[i], &self[Int(arc4random_uniform(UInt32(i+1)))]) }
    }

}