<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Int/Words-swift.struct/RandomAccessCollection-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "RandomAccessCollection Implementations"
}
-->

# RandomAccessCollection Implementations

## Topics

### Instance Methods

[`func distance(from: Self.Index, to: Self.Index) -> Self.Index.Stride`](/documentation/Swift/Int/Words-swift.struct/distance(from:to:))

Returns the distance between two indices.

[`func index(Self.Index, offsetBy: Self.Index.Stride) -> Self.Index`](/documentation/Swift/Int/Words-swift.struct/index(_:offsetBy:))

Returns an index that is the specified distance from the given index.

[`func index(Self.Index, offsetBy: Int, limitedBy: Self.Index) -> Self.Index?`](/documentation/Swift/Int/Words-swift.struct/index(_:offsetBy:limitedBy:))

Returns an index that is the specified distance from the given index,
unless that distance is beyond a given limiting index.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)