Make a square-based 2d terrain generator

Hi. I have been playing around with 2d physics when I found that I could not find a way to make a terrain generator that would make a terrain made up of squares. I have not found any tutorial on this and would like to know how to make it. Any help would be greatly appreciated!

-Qo2770

Edit: I have been searching the web for a long time but I have not found a real tutorial on how to make a basic terrain generator using perlin noise. Could someone help me?

I Would recomend using perlin noise or something simular, Do some research on perlin noise. That should give you an idea on how to make an algorithm to generate the terrain