def random_perms(element_list): total_perms = all_perms(element_list) current_group = element_list used_list = [] available_swaps = pair_list(len(element_list)) #used_list.append(element_list) ticker = 0 i = 0 while len(used_list) < general_functions.factorial(len(element_list)):# i < len(total_perms)/len(available_swaps): available_swaps.sort(general_functions.randsort) j=0 while j < len(available_swaps): pair = available_swaps[j] trying = swap(current_group,pair) if trying not in used_list: current_group = trying#swap(current_group,pair) append_group = trying+[] used_list.append(append_group+[])#.append(append_group) #print used_list elif j == len(available_swaps)-1: print 'f*****g shit, cant find an unused swappable pair!!!!!!!!!' ticker+=1 j+=1 i+=1 print '%d fuckups'%ticker return used_list
def fill_list(list): total = [] i = 0 while i < general_functions.factorial(len(list)): b = (swap_perm(list, i))+[] total.append(b) i+=1 return total
def fill_list(self, list): total = [] i = 0 while i < general_functions.factorial(len(list)): b = (self.swap_perm(list, i))+[]#WHY THE HELL DO I HAVE TO DO THIS???? #print b total.append(b) i+=1 return total