Generates a random number between 0 and the specified range