Function to get back a random number with a max boundary