added a random() function to generate random integers with a limit