Ensure random number is within scope