<div dir="ltr"><div><div><div><div><div>I am trying to implement a basic pelin noise function, but I have some problem with the integer to noise function used to generate deterministic noise from integer inputs.<br><br></div>the function I am trying to implement is defined there:<br><a href="http://libnoise.sourceforge.net/noisegen/index.html#continuousnoise">http://libnoise.sourceforge.net/noisegen/index.html#continuousnoise</a><br></div><br></div>and my code so far look like this: <br><br>noise2d :: (Int32, Int32) -> Double<br>noise2d (x, y) = <br>    let m = x + y * 57<br>        n = (shiftR m 13) ^ m<br>        j = (n * (n * n * 15731 + 789221) + 1376312589) .&. 0x7fffffff<br>    in  1.0 - (fromIntegral j / 1073741824.0)<br><br></div>the code compile but I get the same result for any input, due to the fact that n is evaluated to 0.<br><br></div>Is there a better way to do that?<br></div>