Skip to content

Commit f2b7367

Browse files
authored
Merge pull request #1024 from Mrgig7/master
issue resolved #997 and #998
2 parents e592ed6 + 5e8c029 commit f2b7367

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Selection Sampling/README.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func select<T>(from a: [T], count k: Int) -> [T] {
1212
for i in 0..<k {
1313
let r = random(min: i, max: a.count - 1)
1414
if i != r {
15-
swap(&a[i], &a[r])
15+
a.swapAt(i, r) // Corrected line in README
1616
}
1717
}
1818
return Array(a[0..<k])

Selection Sampling/SelectionSampling.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func select<T>(from a: [T], count k: Int) -> [T] {
1717
for i in 0..<k {
1818
let r = random(min: i, max: a.count - 1)
1919
if i != r {
20-
swap(&a[i], &a[r])
20+
a.swapAt(i, r) // Corrected line
2121
}
2222
}
2323
return Array(a[0..<k])

0 commit comments

Comments
 (0)