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

Appearance settings

Commit f2b7367

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

File tree

Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed
Open diff view settings
Collapse file

‎Selection Sampling/README.markdown‎

Copy file name to clipboardExpand all lines: Selection Sampling/README.markdown
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
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])
Collapse file

‎Selection Sampling/SelectionSampling.swift‎

Copy file name to clipboardExpand all lines: Selection Sampling/SelectionSampling.swift
+1-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.