[futurebasic] No Noise

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2002 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Tue, 14 May 2002 08:10:18 -0400
I am told that:

function Noise2(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

is supposed to return a random number from -1.0 to 1.0


However when I Basicatize it, I get back

-0.2817909839
-0.9999999991
-0.9999999991
-0.9999999991
-0.9999999991
-0.9999999991
and so on...


Anybody able to fathom this better?

clear Local
DIM as Double nOne,n
Local FN Noise2#(x as int, y as int)
    n = x + y * 57
    n =  (n << 13)^n
    nOne =  (1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) AND
0X7FFFFFFF)/ 1073741824.0)
END FN = nOne


DIM x,y


For y = 0 to 9
for x = 0 to 9
Print FN Noise2#(x, y)
next x
next y

The single version is


clear Local
DIM as Double nOne,n
Local FN Noise1#(x as int)
x = (x<<13) ^ x
nOne = ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) AND
0X7fffffff) / 1073741824.0)
end FN = nOne

Same poor results.

rc