Add weighted random generation to textgen.py