Sort:  

it's algorithmic based, I've spent some time to write the code for the constructor and then just let it work :)

Oh, that's great! I built a generator kinda like that in a game language called C2. Fun stuff.