Javascript version of Perlin Noise generator