Creates an array of shuffled values, using a version of the [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
shuffle([1, 2, 3, 4])
// => [4, 1, 3, 2]
| Name | Type | Attribute | Description |
|---|---|---|---|
| array | The array to shuffle. |
{
"comment": "/**\r\n * Creates an array of shuffled values, using a version of the\r\n * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\r\n *\r\n * @since 0.1.0\r\n * @category Array\r\n * @param {Array} array The array to shuffle.\r\n * @returns {Array} Returns the new shuffled array.\r\n * @example\r\n *\r\n * shuffle([1, 2, 3, 4])\r\n * // => [4, 1, 3, 2]\r\n */",
"meta": {
"range": [
413,
838
],
"filename": "shuffle.js",
"lineno": 16,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100008125",
"name": "shuffle",
"type": "FunctionDeclaration",
"paramnames": [
"array"
]
},
"vars": {
"length": "shuffle~length",
"index": "shuffle~index",
"lastIndex": "shuffle~lastIndex",
"result": "shuffle~result",
"rand": "shuffle~rand",
"value": "shuffle~value",
"result[undefined]": "shuffle~result[undefined]"
}
},
"description": "Creates an array of shuffled values, using a version of the\r[Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).",
"since": "0.1.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Array",
"value": "Array"
}
],
"params": [
{
"type": {
"names": [
"Array"
]
},
"description": "The array to shuffle.",
"name": "array"
}
],
"returns": [
{
"type": {
"names": [
"Array"
]
},
"description": "Returns the new shuffled array."
}
],
"examples": [
"shuffle([1, 2, 3, 4])\r// => [4, 1, 3, 2]"
],
"name": "shuffle",
"longname": "shuffle",
"kind": "function",
"scope": "global",
"___id": "T000002R000747",
"___s": true,
"filepath": "shuffle.js"
}