I built this for a game i'm working on yesterday. It's based on some of the code in this video here: youtu.be/cNVX0Qp7JL8
The generator is a rough translation of that GMK to C2. It's nothing fancy, but maybe someone can learn from it/tear it apart for their own use. It's also a little unusual (and probably backwards) in that it doesn't use any arrays.
Demo here
CAPX here
Feel free to drop comments, and if anyone can use it for something, don't hesitate