Skip to content

Commit

Permalink
Merge pull request #1024 from Mrgig7/master
Browse files Browse the repository at this point in the history
issue resolved  #997 and #998
  • Loading branch information
kelvinlauKL authored Dec 6, 2024
2 parents e592ed6 + 5e8c029 commit f2b7367
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Selection Sampling/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func select<T>(from a: [T], count k: Int) -> [T] {
for i in 0..<k {
let r = random(min: i, max: a.count - 1)
if i != r {
swap(&a[i], &a[r])
a.swapAt(i, r) // Corrected line in README
}
}
return Array(a[0..<k])
Expand Down
2 changes: 1 addition & 1 deletion Selection Sampling/SelectionSampling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func select<T>(from a: [T], count k: Int) -> [T] {
for i in 0..<k {
let r = random(min: i, max: a.count - 1)
if i != r {
swap(&a[i], &a[r])
a.swapAt(i, r) // Corrected line
}
}
return Array(a[0..<k])
Expand Down

0 comments on commit f2b7367

Please sign in to comment.