# SHUFFLE

**The SHUFFLE function takes the items in any given list and re-orders them randomly.**

This function takes any list as input. It outputs another list with all the same items as the first list in a random order.

#### Declaration

```javascript
SHUFFLE(list) -> shuffled_list
```

&#x20;

#### Parameters

**list** (required, type: list) A list containing any number of items. These items can be of any type and do not need to be the same type as each other.

#### Return Values

**shuffled\_list** (type: _list_) The resulting shuffled list with all the items randomly re-ordered.

#### Examples

The following example takes a list of numbers one through six and puts them in a random order. Note that running the same formula three separate times results in three slightly different outputs. Each time the SHUFFLE function is called upon, it randomizes anew:

```javascript
SHUFFLE([1, 2, 3, 4, 5, 6]) -> [2, 4, 3, 6, 1, 5]  
SHUFFLE([1, 2, 3, 4, 5, 6]) -> [6, 1, 5, 4, 2, 3]  
SHUFFLE([1, 2, 3, 4, 5, 6]) -> [3, 2, 4, 6, 5, 1]
```

The above example, **list** was hardcoded, but that doesn't need to be the case. For the last example, assume the formula has access to the following list:

```javascript
example_list = [[1, 2, 3], 1, "hello", "this is a string", {"name":"John"}]
```

Note that **example\_list** consists of myriad [types of values.](../../variable-data-types/data-types-overview) The first value is a [Number](../../variable-data-types/the-number-variable-data-type) (1), the second and third values are [strings](../../variable-data-types/the-text-variable-data-type) ("hello" and "this is a string"), the fourth value is a [List](../../variable-data-types/the-list-data-type) ( \[1, 2, 3] ), and the fifth value is an [object](../../variable-data-types/the-list-data-type) ( {"name" :  "John"} ). This list was chosen not because it is particularly likely to be encountered it in the wild, but to emphasize that the values listed in **list** do not at all need to be same type as each other. The following example takes the disparate items in **example\_list** and shuffles them into a random order. Again, note that running the same formula multiple times results in different ordering:

```javascript
SHUFFLE(example_list) -> [{"name":"John"}, 1, "hello", "this is a string", [1, 2, 3] ]  
SHUFFLE(example_list) -> [1, {"name":"John"}, "this is a string", [1, 2, 3], "hello" ]  
SHUFFLE(example_list) -> ["this is a string", "hello", [1, 2, 3], {"name":"John"}, 1 ]
```
