{"ScriptPreparationCode":"function triangular(a, b, c) {\r\n const f = (c - a)/(b - a);\r\n const rand = Math.random();\r\n let x;\r\n if (rand \u003C f) {\r\n x = a \u002B Math.sqrt(rand*(b - a)*(c - a))\r\n } else {\r\n x = b - Math.sqrt((1 - rand)*(b - a)*(b - c))\r\n }\r\n return x;\r\n}\r\n\r\nfunction triangularSymmetric(mean, radius) {\r\n let x;\r\n const doubleRadiusSquared = 2 * radius * radius;\r\n const rand = Math.random();\r\n if (rand \u003C 0.5) {\r\n x = mean - radius \u002B Math.sqrt(rand*doubleRadiusSquared)\r\n } else {\r\n x = mean \u002B radius - Math.sqrt((1 - rand)*doubleRadiusSquared)\r\n }\r\n return x;\r\n}","TestCases":[{"Name":"Triangular","Code":"triangular(-1, 1, 0)","IsDeferred":false},{"Name":"Triangular Symmetric","Code":"triangularSymmetric(0, 1)","IsDeferred":false}]}