[nem-en] System.OverflowError

kamil kstachowski at o2.pl
Thu Oct 27 04:10:52 CEST 2005


hello :)

i'm trying to write a perlin noise generator but i can't get past the random 
numbers generator function. i looked at a couple of tutorials and found out 
they're actually all using the same function.

here is the appropriate part of the code translated from the original code in 
c# i found at http://www.animeimaging.com/asp/PerlinNoise.aspx:
public static Main():void{
	def rand(x:int, y:int):double{
		mutable n=x+y*57;
		n=(n<<13)%^n;
		1.0-((n*(n*n*15731+789221)+1376312589)%&0x7fffffff )/1073741824.0;
	}

	System.Console.WriteLine(rand(1,2));
}

and here is the error i keep getting when trying to run it:
Unhandled Exception: System.OverflowException: Number overflow.
in <0x00041> Perlin:Main ()

i tried using the original c# code and rewriting it to python and had no 
problems running any of the two.

please, tell me what i could do to it to make it work?



More information about the devel-en mailing list