Skip to content

Commit

Permalink
issue resolved #997 and #998
Browse files Browse the repository at this point in the history
Correction of the README.markdown and Selection Sampling code improvement #998
  • Loading branch information
Mrgig7 committed Oct 7, 2024
1 parent e592ed6 commit 5e8c029
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 5e8c029

Please sign in to comment.