{"ScriptPreparationCode":"/**\r\n * Gets a random number between 2 bigInts\r\n * @param {BigInt} max\r\n * @param {BigInt} [min=0n]\r\n * @returns {BigInt}\r\n */\r\nfunction randomBetween(max, min = 0n) {\r\n max = BigInt(max);\r\n min = BigInt(min);\r\n if (max \u003C min) {\r\n [max, min] = [min, max]\r\n }\r\n const range = max - min;\r\n const count = calculatePrecision(range);\r\n let random = new Array(Number(count))\r\n .fill(0)\r\n .map(() =\u003E BigInt(Math.floor(Math.random() * (2 ** 32))))\r\n .map((int, index) =\u003E int \u003C\u003C (BigInt(index) * 32n))\r\n .reduce((acc, int) =\u003E acc \u002B int, 0n);\r\n\r\n\r\n let bitCount = countBits(range);\r\n let minRandom = random \u003E\u003E ((32n * count) - bitCount);\r\n if (minRandom \u003E range) return randomBetween(max, min);\r\n else return minRandom \u002B min;\r\n}\r\n\r\nfunction calculatePrecision(range) {\r\n const result = range \u003E\u003E 32n;\r\n if (result \u003E= 1n) {\r\n return calculatePrecision(result) \u002B 1n;\r\n }\r\n return 1n;\r\n}\r\n\r\nfunction countBits(range) {\r\n const result = range \u003E\u003E 1n;\r\n if (result \u003E= 1n) {\r\n return countBits(result) \u002B 1n;\r\n }\r\n return 1n;\r\n}\r\n\r\nconst a = randomBetween(10n ** 20n, 10n ** 19n)\r\nconst b = randomBetween(10n ** 20n, 10n ** 19n)\r\naBigInt = a;\r\nbBigInt = b;\r\naString = a.toString();\r\nbString = b.toString();\r\naFloat = Number(a);\r\nbFloat = Number(b);","TestCases":[{"Name":"float multiply","Code":"return aFloat * bFloat;","IsDeferred":false},{"Name":"bigInt multiply","Code":"return aBigInt * bBigInt;","IsDeferred":false},{"Name":"float compare","Code":"return aFloat === bFloat;","IsDeferred":false},{"Name":"bigInt compare","Code":"return aBigInt === bBigInt","IsDeferred":false},{"Name":"string compare","Code":"return aString === bString","IsDeferred":false},{"Name":"float greater","Code":"return aFloat \u003E bFloat;","IsDeferred":false},{"Name":"bigint greater","Code":"return aBigInt \u003E bBigInt;","IsDeferred":false},{"Name":"string greater","Code":"return aString \u003E bString","IsDeferred":false},{"Name":"toString bigInt","Code":"return aBigInt.toString();","IsDeferred":false},{"Name":"toString float","Code":"return aFloat.toString();","IsDeferred":false},{"Name":"toFloat bigInt","Code":"return Number(aBigInt);","IsDeferred":false},{"Name":"toFloat string","Code":"return parseInt(aString, 10);","IsDeferred":false}]}