import itertools, random pl = [''.join(p) for p in itertools.permutations([chr(65 + x) for x in range(11)])] sections = set() while len(sections) < 3500: sections.add(random.randint(0, 480924 * 83)) sectstrs = ['\n'.join(pl[x:x+83]) for x in sections] with open('permutes.txt', 'w') as pf: for _ in range(19): random.shuffle(sectstrs) pf.write('\n'.join(sectstrs) + '\n')