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 0dd55b3

Browse filesBrowse files
📚 docs(_fisheryates): Add important note about the definition of k.
1 parent 67bdac4 commit 0dd55b3
Copy full SHA for 0dd55b3

File tree

1 file changed

+3
-1
lines changed
Filter options

1 file changed

+3
-1
lines changed

‎src/kernel/_fisheryates.js

Copy file name to clipboardExpand all lines: src/kernel/_fisheryates.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
const _fisheryates = (randint) => (n, a, i, j) => {
66
// We will swap at most n elements
7-
7+
// NOTE: When n = j - i, the last swap swaps a[j-1] with itself,
8+
// which is a NOOP. /!\ HOWEVER, the last swap is NOT a NOOP when
9+
// n < j - i. Hence we cannot let k = i + n - 1 in general.
810
const k = i + n;
911

1012
for (; i < k; ++i) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.