hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

shuffle.md (872B)

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