Expand/Shrink

shuffle

Definition: sequence res = shuffle(sequence s)
Description: Randomise the order of the top-level elements of sequence s.
pwa/p2js: Supported.
Comments: shuffle(tagset(n)) is a quick way to generate a random permutation of 1..n.
Example:
?shuffle(tagset(10))        -- displays eg {9,2,10,6,5,7,1,8,3,4}
Implementation: See builtins\shuffle.e (an autoinclude) for details of the actual implementation.
See Also: rand, tagset