Just an experiment in attempting to create perlin noise in scratch. I don't know how the actual algorithm works so I just tried to make something like it. This does make a 2 dimensional random noise texture, but it has a diagonal tendency. So it was kinda a success but not in the way I wanted. (space key to regenerate)
This my third attempt at making random generation. Yes, you could actually use this as a sample for terrain heightmaps, but it isn't like perlin noise. (Right click on window to download png of canvas) How it works is pretty simple, it just generates a randomly lighted line of pixels at the top, then starting with the first pixel on the second row, each pixel adds together the brightness of the pixels to the top and left of it, and adds or subtracts from that value.