diff --git a/.travis.yml b/.travis.yml index 455a37f..063ff8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: objective-c -osx_image: xcode9 +osx_image: xcode9.3 script: - swift build diff --git a/Benchmarking/Shuffle.swift b/Benchmarking/Shuffle.swift index 34a348c..dc32a2a 100644 --- a/Benchmarking/Shuffle.swift +++ b/Benchmarking/Shuffle.swift @@ -28,19 +28,19 @@ extension FixedWidthInteger { } } -extension RandomAccessCollection where IndexDistance: FixedWidthInteger { +extension RandomAccessCollection { public func randomElement() -> Element { precondition(count > 0) - let offset = Self.IndexDistance.random(below: count) + let offset = Int.random(below: count) let index = self.index(self.startIndex, offsetBy: offset) return self[index] } } -extension RandomAccessCollection where Self: MutableCollection, IndexDistance: FixedWidthInteger { +extension RandomAccessCollection where Self: MutableCollection { public mutating func shuffle() { for i in indices { - let offset = IndexDistance.random(below: self.distance(from: i, to: self.endIndex)) + let offset = Int.random(below: self.distance(from: i, to: self.endIndex)) let j = self.index(i, offsetBy: offset) if i != j { self.swapAt(i, j)