I have:
extension MutableCollection where Index == Int { // shuffle elements of self in place
mutating func shuffleInPlace() {
if count < 2 { return } // empty and single-element collections don't shuffle
for i in 0 ..< count - 1 {
let j = Int( arc4random_uniform( UInt32( count - i ) ) ) + i
guard i != j else { continue }
swap( &self[ i ], &self[ j ] )
...
...
and I'm getting the error:
Binary operator Binary operator '..<' cannot be applied to operands of type 'Int' and 'Self.IndexDistance'
Does anyone know how to rectify this?