Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f2b7367

Browse files
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /