Knuth shuffle: Difference between revisions

m
(add RPL)
Line 4,434:
 
=={{header|RPL}}==
IndexThe inindex of RPL lists and arrays starts at 1.
{{works with|Halcyon Calc|4.2.7}}
{| class="wikitable"
Line 4,448:
≫ ‘'''KNUTH'''’ STO
|
'''KNUTH''' ''( { list } -- { shuffled list} )'' // works also with [ arrays ]
for j from last downto 2 do:
let k = random integer in range 01 ≤ j ≤ i
swap items[j] with items[k]
1,150

edits