I'm a web developer and I am keen to start writing my own games.

For familiarity, I've chosen JavaScript and `canvas` element for now.

I want to generate some terrain like that in Scorched Earth.

![Scorched Earth](https://i.stack.imgur.com/zHLQt.png)

My first attempt made me realise I couldn't just randomise the `y` value; there had to be some sanity in the peaks and troughs.

I have Googled around a bit, but either I can't find something simple enough for me or I am using the wrong keywords.

Can you please show me what sort of algorithm I would use to generate something in the example, keeping in mind that I am completely new to games programming (since making Breakout in 2003 with Visual Basic anyway)?