mirror of
https://github.com/samsonjs/SwiftBatteries.git
synced 2026-04-27 15:07:46 +00:00
Index.Distance has to be IntMax
This commit is contained in:
parent
44dfb748ee
commit
3f0daeded7
1 changed files with 3 additions and 3 deletions
|
|
@ -49,9 +49,9 @@ public extension CollectionType where Index: RandomAccessIndexType {
|
||||||
guard !isEmpty else {
|
guard !isEmpty else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
let max = Int(count.toIntMax())
|
let n = Int(count.toIntMax())
|
||||||
let n = randomInt(max) - 1
|
let i = startIndex.advancedBy(Index.Distance(IntMax(randomInt(n) - 1)))
|
||||||
return self[startIndex.advancedBy(n)]
|
return self[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue