{"ScriptPreparationCode":"// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random#getting_a_random_integer_between_two_values_inclusive\r\nfunction getRandomIntInclusive(min, max) {\r\n min = Math.ceil(min);\r\n max = Math.floor(max);\r\n return Math.floor(Math.random() * (max - min \u002B 1) \u002B min); //The maximum is inclusive and the minimum is inclusive\r\n}\r\n\r\nfunction shuffleOliver(array) {\r\n let current;\r\n let top;\r\n let tmp = (current = top = array?.length);\r\n\r\n if (!top) {\r\n return array;\r\n }\r\n\r\n while (--top) {\r\n current = getRandomIntInclusive(0, top);\r\n tmp = array[current];\r\n array[current] = array[top];\r\n array[top] = tmp;\r\n }\r\n return array;\r\n};\r\n\r\nfunction shuffleAndrea(array) {\r\n let {length} = array;\r\n while (length--) {\r\n let i = getRandomIntInclusive(0, length);\r\n [array[i], array[length]] = [array[length], array[i]];\r\n }\r\n return array;\r\n};\r\n\r\nfunction shuffleNikolay(array) {\r\n const t = array.splice(0, array.length);\r\n while (t.length \u003E 0) {\r\n const index = getRandomIntInclusive(0, t.length - 1);\r\n array.push(t.splice(index, 1)[0]);\r\n }\r\n return array;\r\n};\r\n\r\nwindow.array_10000 = Array.from(Array(10000).keys());","TestCases":[{"Name":"Nikolay","Code":"shuffleNikolay(window.array_10000);","IsDeferred":false},{"Name":"Oliver","Code":"shuffleOliver(window.array_10000);","IsDeferred":false},{"Name":"Andrea","Code":"shuffleAndrea(window.array_10000);","IsDeferred":false}]}