github.com/rabbouni145/gg@v0.47.1/docs/content/en/functions/shuffle.md (about) 1 --- 2 title: shuffle 3 # linktitle: 4 description: Returns a random permutation of a given array or slice. 5 godocref: 6 date: 2017-02-01 7 publishdate: 2017-02-01 8 lastmod: 2017-04-30 9 keywords: [ordering] 10 categories: [functions] 11 menu: 12 docs: 13 parent: "functions" 14 signature: ["shuffle COLLECTION"] 15 workson: [] 16 hugoversion: 17 relatedfuncs: [seq] 18 deprecated: false 19 draft: false 20 aliases: [] 21 --- 22 23 {{< code file="shuffle-input.html" >}} 24 <!-- Shuffled sequence = --> 25 <div>{{ shuffle (seq 1 5) }}</div> 26 <!-- Shuffled slice = --> 27 <div>{{ shuffle (slice "foo" "bar" "buzz") }}</div> 28 {{< /code >}} 29 30 This example would return the following: 31 32 {{< output file="shuffle-output.html" >}} 33 <!-- Shuffled sequence = --> 34 <div>2 5 3 1 4</div> 35 <!-- Shuffled slice = --> 36 <div>buzz foo bar</div> 37 {{< /output >}} 38 39 This example also makes use of the [slice](/functions/slice/) and [seq](/functions/seq/) functions.