I was looking into random number generators and found pseudo code for one:
function Noise1(integer x)
x = (x<<13) ^ x;
return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0);
end function
I would like to convert this into C# but I get all kinds of error like invalid expressions and “)” expected. This is what I have so far how can I convert it?
double Noise(int x) {
x = (x<<13) ^ x;
return ( 1.0 - ((x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0);
}
Thanks.
I don’t know what language you’ve started with, but in C# hex constants should look differently: change
7fffffffto0x7fffffff.