2023-04-01 08:29:16 -07:00

728 B

title description keywords categories menu signature relatedfuncs
shuffle Returns a random permutation of a given array or slice.
ordering
functions
docs
parent
functions
shuffle COLLECTION
seq

{{< code file="shuffle-input.html" >}}

{{ shuffle (seq 1 5) }}
{{ shuffle (slice "foo" "bar" "buzz") }}
{{< /code >}}

This example would return the following:

{{< output file="shuffle-output.html" >}}

2 5 3 1 4
buzz foo bar
{{< /output >}}

This example also makes use of the slice and seq functions.