Robert Covington wrote: > I would like to know why the below generator fails in FB...is it > because it requires "wide" math, that 64 bit stuff available in C > compilers? It seems that the n = (n<<13) ^ n overflows eventually? > > C: > fn Noise2D(integer x, integer y) > n = x + y * 57 > n = (n<<13) ^ n; > return ( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & > 7fffffff) / 1073741824.0); > end function local mode local fn Noise2D#( x as long, y as long ) '~'1 dim as long n n = x + y * 57 n = (n<<13) xor n n = (n * (n * n * 15731 + 789221) + 1376312589) and 0x7fffffff end fn = 1.0 - n/1073741824.0 Robert P.