Skip to content

Instantly share code, notes, and snippets.

@lxneng
Created July 15, 2019 02:22

Revisions

  1. lxneng renamed this gist Jul 15, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. lxneng created this gist Jul 15, 2019.
    7 changes: 7 additions & 0 deletions shuffe-array
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    function shuffle(a) {
    for (let i = a.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [a[i], a[j]] = [a[j], a[i]];
    }
    return a;
    };