{"ScriptPreparationCode":"\r\n// Jeff Ward v7\r\nvar lut = []; for (var i=0; i\u003C256; i\u002B\u002B) { lut[i] = (i\u003C16?\u00270\u0027:\u0027\u0027)\u002B(i).toString(16); }\r\nfunction e7()\r\n{\r\n var d0 = Math.random()*0xffffffff|0;\r\n var d1 = Math.random()*0xffffffff|0;\r\n var d2 = Math.random()*0xffffffff|0;\r\n var d3 = Math.random()*0xffffffff|0;\r\n return lut[d0\u00260xff]\u002Blut[d0\u003E\u003E8\u00260xff]\u002Blut[d0\u003E\u003E16\u00260xff]\u002Blut[d0\u003E\u003E24\u00260xff]\u002B\u0027-\u0027\u002B\r\n lut[d1\u00260xff]\u002Blut[d1\u003E\u003E8\u00260xff]\u002B\u0027-\u0027\u002Blut[d1\u003E\u003E16\u00260x0f|0x40]\u002Blut[d1\u003E\u003E24\u00260xff]\u002B\u0027-\u0027\u002B\r\n lut[d2\u00260x3f|0x80]\u002Blut[d2\u003E\u003E8\u00260xff]\u002B\u0027-\u0027\u002Blut[d2\u003E\u003E16\u00260xff]\u002Blut[d2\u003E\u003E24\u00260xff]\u002B\r\n lut[d3\u00260xff]\u002Blut[d3\u003E\u003E8\u00260xff]\u002Blut[d3\u003E\u003E16\u00260xff]\u002Blut[d3\u003E\u003E24\u00260xff];\r\n}\r\n\r\n// Broofa (old)\r\nfunction uuidv4_old() {\r\n return \u0027xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\u0027.replace(/[xy]/g, function(c) {\r\n var r = Math.random() * 16 | 0, v = c == \u0027x\u0027 ? r : (r \u0026 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n}\r\n\r\n\r\n// Jon Surrell (not real UUID)\r\nfunction guid() {\r\n function s4() {\r\n return Math.floor((1 \u002B Math.random()) * 0x10000)\r\n .toString(16)\r\n .substring(1);\r\n }\r\n return s4() \u002B s4() \u002B \u0027-\u0027 \u002B s4() \u002B \u0027-\u0027 \u002B s4() \u002B \u0027-\u0027 \u002B\r\n s4() \u002B \u0027-\u0027 \u002B s4() \u002B s4() \u002B s4();\r\n}\r\n\r\n// My Test\r\nvar UUID = (new function() {\r\n this._lut = []; for (var i = 0; i \u003C 256; i\u002B\u002B) {\r\n this._lut[i] = (i \u003C 16 ? \u00270\u0027 : \u0027\u0027) \u002B (i).toString(16);\r\n };\r\n\r\n this._format = function (rarr) {\r\n return \u0027\u0027 \u002B\r\n this._lut[rarr[0] \u0026 0xff] \u002B this._lut[rarr[0] \u003E\u003E 8 \u0026 0xff] \u002B this._lut[rarr[0] \u003E\u003E 16 \u0026 0xff] \u002B this._lut[rarr[0] \u003E\u003E 24 \u0026 0xff] \u002B \u0027-\u0027 \u002B\r\n this._lut[rarr[1] \u0026 0xff] \u002B this._lut[rarr[1] \u003E\u003E 8 \u0026 0xff] \u002B \u0027-\u0027 \u002B\r\n this._lut[rarr[1] \u003E\u003E 16 \u0026 0x0f | 0x40] \u002B this._lut[rarr[1] \u003E\u003E 24 \u0026 0xff] \u002B \u0027-\u0027 \u002B\r\n this._lut[rarr[2] \u0026 0x3f | 0x80] \u002B this._lut[rarr[2] \u003E\u003E 8 \u0026 0xff] \u002B \u0027-\u0027 \u002B\r\n this._lut[rarr[2] \u003E\u003E 16 \u0026 0xff] \u002B this._lut[rarr[2] \u003E\u003E 24 \u0026 0xff] \u002B\r\n this._lut[rarr[3] \u0026 0xff] \u002B this._lut[rarr[3] \u003E\u003E 8 \u0026 0xff] \u002B\r\n this._lut[rarr[3] \u003E\u003E 16 \u0026 0xff] \u002B this._lut[rarr[3] \u003E\u003E 24 \u0026 0xff];\r\n };\r\n\r\n this._getRandomness = function () {\r\n if (\u0027crypto\u0027 in window \u0026\u0026 \u0027Uint32Array\u0027 in window) {\r\n var dvals = new Uint32Array(4);\r\n window.crypto.getRandomValues(dvals);\r\n return dvals\r\n }\r\n return [\r\n Math.random() * 0x100000000 \u003E\u003E\u003E 0,\r\n Math.random() * 0x100000000 \u003E\u003E\u003E 0,\r\n Math.random() * 0x100000000 \u003E\u003E\u003E 0,\r\n Math.random() * 0x100000000 \u003E\u003E\u003E 0,\r\n ];\r\n };\r\n\r\n this.generate = function () {\r\n return this._format(this._getRandomness());\r\n };\r\n}());\r\n\r\nfunction domId(prefix) {\r\n return \u0060${prefix}-${Math.round(Math.random() * Date.now()).toString(16)}\u0060;\r\n}\r\n","TestCases":[{"Name":"Jeff Ward v7","Code":"e7();","IsDeferred":false},{"Name":"Jon Surrell (not real UUID)","Code":"guid();","IsDeferred":false},{"Name":"Broofa (old)","Code":"uuidv4_old();","IsDeferred":false},{"Name":"My Test","Code":"UUID.generate();","IsDeferred":false},{"Name":"Not even close to a UUID but good enough for my purposes","Code":"domId(\u0027element\u0027);","IsDeferred":false}]}