Both Perlin and PerlinSimplex are already instantiated as global variables. Both implement the same methods.

Simply call Perlin.noise(x,y,z) to get a noise value (y and z are optional).

You can set the amount of octaves and falloff by calling Perlin.noisedetail(octaves,falloff). Octaves can be any whole number greater than zero (but the higher the number, the slower the render). The falloff should be a floating point between 0 and 1 (0.5 usually works just fine).

By default Math is used for random number generation. This works fine for static field but is useless for animation because Math.random() cannot be seeded. For this example I've implemented a very simple pseudo random number generator. You can very easily implement your own by setting Perlin.setRng(myRng) as long as it has the 'random' method.