const shuffle = ([...arr]) => { let m = arr.length; while (m) { const i = Math.floor(Math.random() * m--); [arr[m], arr[i]] = [arr[i], arr[m]]; } return arr; };let list = [1, 2, 3, 4, 5, 6, 7, 8, 9]; // you can use Math.random to randomly sort any // type of elements, not just numbers list = list.sort(() => Math.random() - 0.5);