> For the complete documentation index, see [llms.txt](https://lodash.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodash.shujuwajue.com/collection/shuffle.md).

# \_.shuffle（创建一个被打乱的数组集合）

**语法：**

```javascript
_.shuffle(collection)
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L9816)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.shuffle)

**描述：**

创建一个被打乱值的集合。 使用[Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle)版本。

**开始版本：**&#x30;.1.0

**参数：**

* `collection (Array|Object)`: 要打乱的集合。

**返回值：**

* `(Array)`: 返回打乱的新数组。

**例子：**

```javascript
_.shuffle([1, 2, 3, 4]);
// => [4, 1, 3, 2]
```
