{"ScriptPreparationCode":null,"TestCases":[{"Name":"1","Code":"const generateUUID = () =\u003E\r\n ([1e7] \u002B -1e3 \u002B -4e3 \u002B -8e3 \u002B -1e11).replace(/[018]/g, e =\u003E\r\n // eslint-disable-next-line no-bitwise\r\n (e ^ ((window.crypto || window.msCrypto).getRandomValues(new Uint8Array(1))[0] \u0026 (15 \u003E\u003E (e / 4)))).toString(16)\r\n );\r\n\r\n\r\ngenerateUUID();","IsDeferred":false},{"Name":"2","Code":" function uuid() {\r\n let uuid = \u0022\u0022,\r\n i,\r\n random;\r\n for (i = 0; i \u003C 32; i\u002B\u002B) {\r\n random = (Math.random() * 16) | 0;\r\n\r\n if (i == 8 || i == 12 || i == 16 || i == 20) {\r\n uuid \u002B= \u0022-\u0022;\r\n }\r\n uuid \u002B= (i == 12 ? 4 : i == 16 ? (random \u0026 3) | 8 : random).toString(16);\r\n }\r\n return uuid;\r\n}\r\n\r\nuuid();","IsDeferred":false},{"Name":"3","Code":" function uuid1(a) {\r\n return a\r\n ? (a ^ ((Math.random() * 16) \u003E\u003E (a / 4))).toString(16)\r\n : ([1e7] \u002B -1e3 \u002B -4e3 \u002B -8e3 \u002B -1e11).replace(/[018]/g, uuid1);\r\n}\r\n\r\nuuid1()\r\n","IsDeferred":false},{"Name":"4","Code":"var IDX=256, HEX=[], BUFFER;\r\nwhile (IDX--) HEX[IDX] = (IDX \u002B 256).toString(16).substring(1);\r\n\r\n\r\nfunction v4() {\r\n\tvar i=0, num, out=\u0027\u0027;\r\n\r\n\tif (!BUFFER || ((IDX \u002B 16) \u003E 256)) {\r\n\t\tBUFFER = Array(i=256);\r\n\t\twhile (i--) BUFFER[i] = 256 * Math.random() | 0;\r\n\t\ti = IDX = 0;\r\n\t}\r\n\r\n\tfor (; i \u003C 16; i\u002B\u002B) {\r\n\t\tnum = BUFFER[IDX \u002B i];\r\n\t\tif (i==6) out \u002B= HEX[num \u0026 15 | 64];\r\n\t\telse if (i==8) out \u002B= HEX[num \u0026 63 | 128];\r\n\t\telse out \u002B= HEX[num];\r\n\r\n\t\tif (i \u0026 1 \u0026\u0026 i \u003E 1 \u0026\u0026 i \u003C 11) out \u002B= \u0027-\u0027;\r\n\t}\r\n\r\n\tIDX\u002B\u002B;\r\n\treturn out;\r\n}\r\n\r\nv4();","IsDeferred":false},{"Name":"5","Code":"const ui8a = new Uint8Array(1);\r\nvar IDX=256, HEX=[], BUFFER = Array(IDX);\r\nwhile (IDX--) HEX[IDX] = (IDX \u002B 256).toString(16).substring(1);\r\n\r\n\r\nfunction v4() {\r\n\tvar i=0, num, out=\u0027\u0027;\r\n\r\n\tif ((IDX \u002B 16) \u003E 256) {\r\n\t\twhile (i--) BUFFER[i] = 256 * crypto.getRandomValues(ui8a)[0] | 0;\r\n\t\ti = IDX = 0;\r\n\t}\r\n\r\n\tfor (; i \u003C 16; i\u002B\u002B) {\r\n\t\tnum = BUFFER[IDX \u002B i];\r\n\t\tif (i==6) out \u002B= HEX[num \u0026 15 | 64];\r\n\t\telse if (i==8) out \u002B= HEX[num \u0026 63 | 128];\r\n\t\telse out \u002B= HEX[num];\r\n\r\n\t\tif (i \u0026 1 \u0026\u0026 i \u003E 1 \u0026\u0026 i \u003C 11) out \u002B= \u0027-\u0027;\r\n\t}\r\n\r\n\tIDX\u002B\u002B;\r\n\treturn out;\r\n}\r\n\r\nv4();","IsDeferred":false},{"Name":"6","Code":"const ui8a = new Uint8Array(1);\r\n function uuid() {\r\n let uuid = \u0022\u0022,\r\n i,\r\n random;\r\n for (i = 0; i \u003C 32; i\u002B\u002B) {\r\n random = (crypto.getRandomValues(ui8a)[0] * 16) | 0;\r\n\r\n if (i == 8 || i == 12 || i == 16 || i == 20) {\r\n uuid \u002B= \u0022-\u0022;\r\n }\r\n uuid \u002B= (i == 12 ? 4 : i == 16 ? (random \u0026 3) | 8 : random).toString(16);\r\n }\r\n return uuid;\r\n}\r\n\r\nuuid();","IsDeferred":false},{"Name":"7","Code":"const ui8a = new Uint8Array(1);\r\n function uuid() {\r\n let uuid = \u002200000000-000-000-000-00000000000\u0022,\r\n i,\r\n random;\r\n for (i = 0; i \u003C 32; i\u002B\u002B) {\r\n random = (crypto.getRandomValues(ui8a)[0] * 16) | 0;\r\n\r\n if (i === 8 || i === 12 || i === 16 || i === 20) continue;\r\n uuid[i] = (i == 12 ? 4 : i == 16 ? (random \u0026 3) | 8 : random).toString(16);\r\n }\r\n return uuid;\r\n}\r\n\r\nuuid();","IsDeferred":false},{"Name":"8","Code":"const ui8a = new Uint8Array(1);\r\n function uuid() {\r\n let uuid = \u002200000000-000-000-000-00000000000\u0022,\r\n i = 0,\r\n random;\r\n while(i \u003C 32) {\r\n if (i === 8 || i === 12 || i === 16 || i === 20) {\r\n } else {\r\n\t random = (crypto.getRandomValues(ui8a)[0] * 16) | 0;\r\n uuid[i] = (i === 12 ? 4 : i === 16 ? (random \u0026 3) | 8 : random).toString(16);\r\n }\r\n i\u002B\u002B;\r\n }\r\n return uuid;\r\n}\r\n\r\nuuid();","IsDeferred":false}]}