import random
random_number = ''
for x in range(4):
random_number = random_number + str(random.randint(0, 9))
from random import randint
random_number = ""
while len(random_number) < 4:
a = str(randint(0, 9))
if a not in random_number:
random_number += a