for i in range(amount):
    randnum = istart
while randnum in range(istart, iend + 1) or randnum in all:
    randnum = randint(start, end)
all.append(randnum)
return all
Python random unique values from two non overlapping ranges