Perlin noise in 2 dimensions expression
From Castle Wiki
See the Wikipedia page on Perlin noise for more information.
Perlin noise is an expression that takes in two values, an X and Y position, and returns a single value between 0 and 1. The value returned by Perlin noise is a psuedo-random value and can form pleasingly random yet uniformly distributed patterns when viewed alongside neighboring values. Perlin noise can be used to create natural movement patterns or for generating realistic terrain.