79505539

Date: 2025-03-13 06:13:57
Score: 0.5
Natty:
Report link

Here's something i just came up with:



def permute(elements):
        permutations=[]
        for i in range(999999):
            tmp_elements = elements.copy()
            candidate = []
            while len(tmp_elements)>0:
                index = random.randint(0,len(tmp_elements)-1)
                candidate.append(tmp_elements[index])
                tmp_elements.pop(index)
            if candidate not in permutations:
                permutations.append(candidate)
        permutations.sort()
        return permutations
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: ck13