{"ScriptPreparationCode":null,"TestCases":[{"Name":"map sort map","Code":"const arr = Array.from({length: 10000});\r\nfunction shuffle(arr) {\r\n return arr\r\n .map((name) =\u003E ({ name, randomValue: Math.random() }))\r\n .sort((a, b) =\u003E a.randomValue - b.randomValue)\r\n .map(({ name }) =\u003E name);\r\n}\r\nshuffle(arr)","IsDeferred":false},{"Name":"Fisher-Yates","Code":"const arr = Array.from({length: 10000});\r\nfunction shuffle(array) {\r\n let currentIndex = array.length;\r\n let randomIndex;\r\n while (currentIndex != 0) {\r\n randomIndex = Math.floor(Math.random() * currentIndex);\r\n currentIndex--;\r\n [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];\r\n }\r\n\r\n return array;\r\n}\r\nshuffle(arr)","IsDeferred":false}]}