[futurebasic] Re: [FB] No Noise

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

From: Staz <staz@...>
Date: Wed, 15 May 2002 10:59:55 -0500
rp,

can you try to be more concise and succinct in the future?



> Robert Covington wrote:
> 
>> 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
>> and so on...
>> 
>> 
>> Anybody able to fathom this better?
> 
> 
> local
> dim as long  n, temp
> local fn Noise2#( x as long, y as long )
> n = x + y*57
> n = (n << 13) xor n
> temp = (n*(n*n*15731 + 789221) + 1376312589) and 0x7FFFFFFF
> end fn = (1.0 - temp/1073741824.0)
> 
> 
> dim x, y
> for x = 1 to 5
> for y = 1 to 5
> print x, y, fn Noise2#( x, y )
> next
> next
> 
> 
> Robert P.
> 
> 
> --
> To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>
> 



-STAZ  ~)~