One easy way to do it would be to use the midpoint displacement algorithm:
- Start with a line representing the ceiling.
- At the midpoint, displace it some random amount leaving the end points where they are.
- Now take the resulting 2 line segments and do it to each of those (divide them in half and displace their centers by a random amount).
- Continue doing this until you have a shape you like. Do the same for the floor.
- Repeat the process for the floor, but displace upwards instead of downwards.
Also, see this answerthis answer.