This works almost fine but the number starts with 0 sometimes:
import random numbers = random.sample(range(10), 4) print(\'\'.join(map(str, numbers)))
Just loop until you have something you like:
import random numbers = [0] while numbers[0] == 0: numbers = random.sample(range(10), 4) print(''.join(map(str, numbers)))