Jump to content

Best shuffle: Difference between revisions

Line 1,221:
n = len(w)
rangelists = (list(range(n)), list(range(n)))
while w2old != w2 and n[:]
for r in n -= 1rangelists:
w2old = w2[:]random.shuffle(r)
rangei, rangej for r in= rangelists:
for i in rangei:
random.shuffle(r)
rangei,for rangejj =in rangelistsrangej:
if i != j and w2[j] != w2[i] and w[i] != w2[j] and w[j] != w2[i]:
for i in rangei:
for w2[j], inw2[i] rangej:= w2[i], w2[j]
if i != j and w2[j] != w2[i] and w[i] != w2[j] and w[j] != w2[i]:
w2[j], w2[i] = w2[i], w2[j]
w2 = ''.join(w2)
return w2, count(w, w2)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.