Last active
July 16, 2024 08:29
-
-
Save jonrandy/d97d8fd17849c2069d9a2447b8e99c9b to your computer and use it in GitHub Desktop.
Revisions
-
jonrandy revised this gist
Jan 27, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ function shuffle(array) { let a = [...array], m = a.length, i while (m) { // Pick a remaining element i = ~~(Math.random() * m--); // Swap it with the current element [a[m], a[i]] = [a[i], a[m]] } -
jonrandy revised this gist
Jan 25, 2023 . 1 changed file with 6 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,10 @@ function shuffle(array) { let a = [...array], m = a.length, i while (m) { // Pick a remaining element i = ~~(Math.random() * m--) // Swap it with the current element [a[m], a[i]] = [a[i], a[m]] } return a } -
jonrandy created this gist
Jan 3, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ function shuffle(array) { let a = [...array], m = a.length, i, ; while (m) { // Pick a remaining element… i = ~~(Math.random() * m--); // And swap it with the current element. [a[m], a[i]] = [a[i], a[m]] } return a; }