hugo/content/en/functions/shuffle.md
Bjørn Erik Pedersen b9bd35d72e Squashed 'docs/' content from commit fdea5430f
git-subtree-dir: docs
git-subtree-split: fdea5430f89dfd849d39212abdf5ace0a4763e5a
2019-10-21 10:22:28 +02:00

882 B

title description godocref date publishdate lastmod keywords categories menu signature workson hugoversion relatedfuncs deprecated draft aliases
shuffle Returns a random permutation of a given array or slice. 2017-02-01 2017-02-01 2017-04-30
ordering
functions
docs
parent
functions
shuffle COLLECTION
seq
false false

{{< 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.