Perlin noise partial port from C++