correctly use the random function to get random numbers