How would I generate Perlin noise in the Snap! Editor?

-- like the kind used in terrain generation. I was looking around at all the different terrain generation projects out there (especially @8biteli's perlin project, which kinda inspired this haha) and I know how terrain is generated based on Perlin noise (it's just different types of terrain or pockets of terrain depending on how light/dark the current cell is) but looking at the code to generate it I completely was lost. Could anybody explain how you would generate Perlin noise? (I'm just looking to learn)

Edit: Just to make it really clear: I know how you generate terrain over Perlin noise, that makes perfect sense. I just don't know how to create my own and the code behind it haha

Edit 2: ... or Simplex noise. That's also great if anyone knows how to make it.

Maybe Jens project would help you