I got the generation function to work properly\! Yay\!