Updated functions for generating random numbers, and getting user input