How do change the syntax of this to match Javascript?
function IntNoise(32-bit integer: x)
x = (x<<13) ^ x;
return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0);
end IntNoise function
How do change the syntax of this to match Javascript?
function IntNoise(32-bit integer: x)
x = (x<<13) ^ x;
return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0);
end IntNoise function
I think maybe this would be it, but that assumes that all the data types do what I expect them to (Javascript has weird data types, they sometimes mutate unexpectedly). At the very least it should compile. Give it a shot!
function IntNoise(x : int) : float
{
x = (x << 13) ^ x;
return (1.0 - ((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
}