I'm converting Libnoise.Unity voronoi algorithm to use doubles instead of floats, I've done most of the others, seems easy enough right?
There's a particular algorithm heavy on the magic numbers and light on the comments, I just can't get my head around what they're trying to achieve with the last two lines and what relationship the magic numbers have to each other. Can anybody tell me what I'm missing here? The hex seems to be the max value of an int32 but that's as far as I've got.
internal static long ValueNoise3DInt(int x, int y, int z, int seed)
{
long n = (GeneratorNoiseX * x + GeneratorNoiseY * y + GeneratorNoiseZ * z +
GeneratorSeed * seed) & 0x7fffffff;
n = (n >> 13) ^ n;
return (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
}