Files
hugoDocs/content/functions/shuffle.md
T
Bjørn Erik Pedersen e4824eb3fe Fix the output shortcode and its usage
Passing the shortcode into the Markdown processor just to get pre and code tags does not make much sense.
2017-07-21 13:06:11 +02:00

40 lines
879 B
Markdown

---
title: shuffle
# linktitle:
description: Returns a random permutation of a given array or slice.
godocref:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-04-30
#tags: [ordering]
categories: [functions]
menu:
docs:
parent: "functions"
signature: ["shuffle COLLECTION"]
workson: []
hugoversion:
relatedfuncs: [seq]
deprecated: false
draft: false
aliases: []
---
{{< code file="shuffle-input.html" >}}
<!-- Shuffled sequence = -->
<div>{{ shuffle (seq 1 5) }}</div>
<!-- Shuffled slice = -->
<div>{{ shuffle (slice "foo" "bar" "buzz") }}</div>
{{< /code >}}
This example would return the following:
{{< output file="shuffle-output.html" >}}
<!-- Shuffled sequence = -->
<div>2 5 3 1 4</div>
<!-- Shuffled slice = -->
<div>buzz foo bar</div>
{{< /output >}}
This example also makes use of the [slice](/functions/slice/) and [seq](/functions/seq/) functions.