https://leetcode.com/problems/shuffle-an-array/


Runtime: 248 ms, faster than 42.38% of TypeScript online submissions for Shuffle an Array.
Memory Usage: 54.2 MB, less than 48.34% of TypeScript online submissions for Shuffle an Array.



```
function shuffle(array) {
  var currentIndex = array.length,  randomIndex;

  // While there remain elements to shuffle...
  while (currentIndex != 0) {

    // Pick a remaining element...
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex--;

    // And swap it with the current element.
    [array[currentIndex], array[randomIndex]] = [
      array[randomIndex], array[currentIndex]];
  }

  return array;
}

class Solution {
    nums: number[]

    constructor(nums: number[]) {
        this.nums = nums
    }

    reset(): number[] {
        return this.nums
    }

    shuffle(): number[] {
        return shuffle([...this.nums])
    }
}
```
