python random number generator no duplicates

#This will return a list of 50 numbers selected from the range 0 to 999, without duplicates.
import random
random.sample(range(1000), 50)

Here is what the above code is Doing:
1. The random module is imported.
2. The random.sample() function is called.
3. The range(1000) function is called. This returns a list of numbers from 0 to 999.
4. The random.sample() function is called again, this time with two arguments. The first argument is the list of numbers returned by range(1000). The second argument is the number of items you want to have in your final, random list.
5. The random.sample() function returns a list of 50 randomly chosen numbers.