this works while len(words) < 10000: wd = "" for i in ["".join(choice(alphabet)) for i in range(randint(1,15))]: wd += i words[wd] = None anyway Thanks for that this is exactly what i need..