Shuffle array swift 3

Как я могу преобразовать функцию ниже вswift 3? В настоящее время получаюBinary operator '..<' cannot be applied to operands of type 'Int' and 'Self.IndexDistance' ошибка.

extension MutableCollection where Index == Int {
  /// Shuffle the elements of `self` in-place.
  mutating func shuffleInPlace() {
    // empty and single-element collections don't shuffle
    if count < 2 { return }

    for i in 0..<count - 1 { //error takes place here
      let j = Int(arc4random_uniform(UInt32(count - i))) + i
      guard i != j else { continue }
      swap(&self[i], &self[j])
    }
  }
}

ссылка:https://stackoverflow.com/a/24029847/5222077

Ответы на вопрос(4)

Ваш ответ на вопрос