Does anyone have past knowledge on this (generating random 2D terrain using an algorithm)?

This is probably a stupid post, but, I'm desperate now. I've been trying to write (relatively simple) code to generate (and draw) random fractal terrain in a window sized 800 x 600- But I have failed at all attempts.

I've looked all over the web for the general idea and I found this: Generating Random Fractal Terrain.

My first problem is that I don't have a great idea on how to create "line segments". I've tried making an array with a start (x) position and an end (x) position... But that isn't working very well. If you want to see my code, I will post it (but it is kind of long, not to mention embarrassing).

I'm not necessarily looking for the whole code to be written out- I just need a push in the right direction (mainly on how to get the "line segments" going).

Any and all help would be appreciated!
Thanks in advance.