Knuth shuffle: Difference between revisions

(Added Uiua solution)
 
(One intermediate revision by the same user not shown)
Line 5,216:
=={{header|Uiua}}==
{{works with|Uiua|0.10.0-dev.1}}
Build pairs of indexes to be swapped then apply these as a fold.
<syntaxhighlight lang="Uiua">
◌⍢⊃Knuth ← ∧(↘1⍜⊏⇌)(⍜⊏⇌⊟⌊×⚂.⊢)(>0⧻⊟⌊×⚂.)⇌↘1⇡⧻. ⇡10
Knuth ⇡10
</syntaxhighlight>
Typical output:
<pre>
[3 0 6 5 7 8 4 1 9 2]
</pre>
 
=={{header|UNIX Shell}}==
60

edits