Another important way to simulate randomness is using Perlin noise generation. Perlin noise generation differs from random generation as it uses a “smooth” sequence of psuedo random numbers, where a singular value in a sequence depends on its predecessors. This is especially useful in creating natural phenomena such as clouds and the textures of materials like marble or wood. Take these examples;
This example assigns a random brightness to each pixel on the screen. Notice how dark pixels are adjacent to light ones, creating a grainy texture.
However this sketch assigns a random brightness to each pixel on the screen using Perlin noise. As the brightness value of each pixel depends on its neighbours, clumps of brightness and darkness form.