{"ScriptPreparationCode":null,"TestCases":[{"Name":"crypto","Code":"const uuid = crypto.randomUUID();\r\nreturn uuid;\r\n","IsDeferred":false},{"Name":"regex v1","Code":" let d = Date.now();\r\n if (\r\n typeof performance !== \u0027undefined\u0027 \u0026\u0026\r\n typeof performance.now === \u0027function\u0027\r\n ) {\r\n d \u002B= performance.now(); // use high-precision timer if available\r\n }\r\n const uuid = \u0027xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\u0027.replace(/[xy]/g, function (c) {\r\n const r = (d \u002B Math.random() * 16) % 16 | 0;\r\n d = Math.floor(d / 16);\r\n return (c === \u0027x\u0027 ? r : (r \u0026 0x3) | 0x8).toString(16);\r\n });\r\n return uuid;","IsDeferred":false},{"Name":"regex v2","Code":"const uuid = () =\u003E [...Array(4)].map(() =\u003E Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join(\u0027-\u0027);\r\nreturn uuid;","IsDeferred":false},{"Name":"regex v3","Code":"const uuid = \u002210000000-1000-4000-8000-100000000000\u0022.replace(/[018]/g, c =\u003E\r\n (\u002Bc ^ crypto.getRandomValues(new Uint8Array(1))[0] \u0026 15 \u003E\u003E \u002Bc / 4).toString(16)\r\n );\r\nreturn uuid;","IsDeferred":false},{"Name":"regex v4","Code":"let\r\n d = new Date().getTime(),\r\n d2 = ((typeof performance !== \u0027undefined\u0027) \u0026\u0026 performance.now \u0026\u0026 (performance.now() * 1000)) || 0;\r\nconst uuid = \u0027xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\u0027.replace(/[xy]/g, c =\u003E {\r\n let r = Math.random() * 16;\r\n if (d \u003E 0) {\r\n r = (d \u002B r) % 16 | 0;\r\n d = Math.floor(d / 16);\r\n } else {\r\n r = (d2 \u002B r) % 16 | 0;\r\n d2 = Math.floor(d2 / 16);\r\n }\r\n return (c == \u0027x\u0027 ? r : (r \u0026 0x7 | 0x8)).toString(16);\r\n});\r\n\r\nreturn uuid;","IsDeferred":false}]}