function shuffle(arr) { // let arr = [].concat(arrp) let i = arr.length; while (i) { const r = Math.floor(Math.random() * i--); console.log(r); [arr[i], arr[r]] = [arr[r], arr[i]]; } return arr } const arr = [1,2,4,6,7,8,6] console.log(arr) console.log(shuffle(arr))