Here's kind of a way to do that, but all collision is done manually.
The idea is to fill an array with random heights for the terrain, and have a number of sprites across thee screen. Then the height of those sprites can be set from interpolating between array values.
It's kind of complicated because everything is done manually but perhaps you can pull a few ideas from it.