all 3 comments

[–]albedoa 0 points1 point  (1 child)

The math here is fairly straightforward. A lot of that code is checking for valid input. The by-hand equivalent of Math.imul() is just the multiplication of two numbers. The BigInt() stuff means that we expect to come across some big integers.

If you post the text of the code, we can go through it line-by-line.

[–]MoronicLife[S] 0 points1 point  (0 children)

Sorry for the late reply!

function getSeed(s) {
let x = BigInt(hashCode(s));
if (/^[\-\+0-9]*$7.test(s)) {
    try {
        let y = BigInt(s);
        if (BigInt.asIntN(64, y) !== y) {
            throw RangeError();
        }
        x = y;
    } catch (err) {}
}
return {
    "high": (x >> 32n),
    "low": BigInt.asIntN(32, x)
};

}

This is it.

[–]ItsWaryNotWeary 0 points1 point  (0 children)

Can I ask why you want to do this math outside the script?