what's the best way to create rolling terrain with Cocos2D?

I'd like to make a side scrolling flying game where the terrain (hills) is generated using mathematical functions .
Has anyone done that and if so, what's the best way to store all that data and to display it in Cocos2D?