This works almost fine but the number starts with 0 sometimes:
import random numbers = random.sample(range(10), 4) print(\'\'.join(map(str, numbers)))
This will allow zeros after the first digit -
numbers = random.sample(range(1,10),1) + random.sample(range(10),3)