create a list that contains your number range and remove 10 random numbers from that list. or something similar... your algorithm has an undefined runtime.