{"ScriptPreparationCode":"function nanoid(t = 21) {\r\n crypto.getRandomValues(new Uint8Array(t)).reduce(((t, e) =\u003E t \u002B= (e \u0026= 63) \u003C 36 ? e.toString(36) : e \u003C 62 ? (e - 26).toString(36).toUpperCase() : e \u003C 63 ? \u0022_\u0022 : \u0022-\u0022), \u0022\u0022);\r\n}\r\n\r\nfunction generateCode(length, containUppercase, groups = 0) {\r\n let result = \u0027\u0027;\r\n let characters = containUppercase ? \u0027ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\u0027 : \u0027abcdefghijklmnopqrstuvwxyz\u0027;\r\n let charactersLength = characters.length;\r\n\r\n for (let i = 0; i \u003C length; i\u002B\u002B) {\r\n result \u002B= characters.charAt(Math.floor(Math.random() * charactersLength));\r\n }\r\n\r\n if (groups) result = result.split(\u0027\u0027).map((l, i, a) =\u003E (i \u002B 1) % groups == 0 \u0026\u0026 i != a.length - 1 ? l \u002B \u0027-\u0027 : l).join(\u0027\u0027)\r\n\r\n return result;\r\n}","TestCases":[{"Name":"nanoid","Code":"for (let i = 0; i \u003C 100000; i\u002B\u002B) {\r\n\tnanoid();\r\n}","IsDeferred":false},{"Name":"generatecode","Code":"for (let i = 0; i \u003C 100000; i\u002B\u002B) {\r\n\tgenerateCode(21, true);\r\n}","IsDeferred":false}]}