{"ScriptPreparationCode":"var possibilities = {\r\n lowerCased: \u0027abcdefghijklmnopqrstuvwxyz\u0027,\r\n capitals: \u0027ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0027,\r\n numbers: \u00270123456789\u0027,\r\n special: \u0027~!@#$%^\u0026()_\u002B-={}[];\\\u0027,\u0027\r\n};\r\n\r\nfunction randomId(len, pattern) {\r\n if (!len) len = 30;\r\n if (!pattern) pattern = \u0027aA0\u0027;\r\n\r\n var chars = \u0027\u0027;\r\n\r\n pattern.split(\u0027\u0027).forEach((a) =\u003E {\r\n if (!isNaN(parseInt(a))) {\r\n chars \u002B= possibilities.numbers;\r\n } else if (/[a-z]/.test(a)) {\r\n chars \u002B= possibilities.lowerCased;\r\n } else if (/[A-Z]/.test(a)) {\r\n chars \u002B= possibilities.capitals;\r\n } else {\r\n chars \u002B= possibilities.special;\r\n }\r\n });\r\n\r\n var result = \u0027\u0027;\r\n\r\n for (var i = 0; i \u003C len; i\u002B\u002B) {\r\n result \u002B= chars.charAt(Math.floor(Math.random() * chars.length));\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction randomId2(len = 30, pattern = \u0027aA0\u0027) {\r\n let chars = \u0027\u0027;\r\n let pl = pattern.length;\r\n while (pl--) {\r\n const ch = pattern[pl];\r\n if (!isNaN(ch)) {\r\n chars \u002B= possibilities.numbers;\r\n } else if (ch === ch.toLowerCase() \u0026\u0026 ch !== ch.toUpperCase()) {\r\n chars \u002B= possibilities.lowerCased;\r\n } else if (ch !== ch.toLowerCase() \u0026\u0026 ch === ch.toUpperCase()) {\r\n chars \u002B= possibilities.capitals;\r\n } else {\r\n chars \u002B= possibilities.special;\r\n }\r\n }\r\n \r\n let result = [];\r\n const cl = chars.length;\r\n while (len--) {\r\n result.push(chars[Math.floor(Math.random() * cl)]);\r\n }\r\n \r\n return result.join(\u0027\u0027);\r\n}","TestCases":[{"Name":"randomId","Code":"randomId(1000000, \u0027aA0-\u0027);","IsDeferred":false},{"Name":"randomid2","Code":"randomId2(1000000, \u0027aA0-\u0027);","IsDeferred":false}]}