Skip to content

Commit 4959770

Browse files
committed
Update Contents.swift
1 parent c8f7617 commit 4959770

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Selection Sampling/SelectionSampling.playground/Contents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func select<T>(from a: [T], count k: Int) -> [T] {
1919
for i in 0..<k {
2020
let r = random(min: i, max: a.count - 1)
2121
if i != r {
22-
swap(&a[i], &a[r])
22+
a.swapAt(i, r)
2323
}
2424
}
2525
return Array(a[0..<k])

0 commit comments

Comments
 (0)