import random
numberRobot = str(random.randint(999,9999))
def check_number():
some_number = ''
for i in numberRobot:
if i not in some_number:
some_number += i
else:
while i in some_number:
i = str(random.randint(1,9))
some_number += i
print(some_number)
<input type="button" value="Assign" onclick="opennewurl('tickets.cgi?jobid=43474&cmd=assign&val=' + encodeURIComponent(document.getElementById('tbAssignedTicket').value))">