Best shuffle: Difference between revisions
m
and a deterministic result
m (output added) |
m (and a deterministic result) |
||
Line 2,128:
<lang Phix>constant tests = {"abracadabra", "seesaw", "elk", "grrrrrr", "up", "a"}
string s,t
for test=1 to length(tests) do
s = tests[test]
Line 2,140 ⟶ 2,139:
end for
end for
▲ printf(1,"%s -> %s (%d)\n",{s,t,c})
end for</lang>
{{out}}
<pre>
abracadabra ->
seesaw -> aswees (0)
elk -> lke (0)
grrrrrr -> rrrgrrr (5)
up -> pu (0)
a -> a (1)
</pre>
By replacing <code>t=shuffle(s)</code> with <code>t=s</code>, the following deterministic result is output every time:
<pre>
abracadabra -> raaracababd (0)
seesaw -> wasese (0)
elk -> lke (0)
grrrrrr -> rgrrrrr (5)
|