{"name":"array-shuffle","version":"4.0.0","keywords":["array","list","shuffle","sort","random","rand","fisher","yates","durstenfeld"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"array-shuffle@4.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/array-shuffle#readme","bugs":{"url":"https://github.com/sindresorhus/array-shuffle/issues"},"dist":{"shasum":"50e2985cb34f8283da13645098ab7a1770cfaa89","tarball":"http://registry-npm.ywwl.com/array-shuffle/download/array-shuffle-4.0.0.tgz","fileCount":5,"integrity":"sha512-C7U1jQYpMCCQcjhPNtngE3Fki2+wFTaPzc5K4jJPY9Wwce9aQp8BwAkgyMhG6WIQEaE1qnrtkT6XoYkatxXTSQ==","signatures":[{"sig":"MEUCIBMgGnMnSRVY6xv3DjFMm234Feu6beFJ/n6+3+NG+jp2AiEA6wtfvFFFERcsDopYlfbVnLeLSg6E836E8EhlE97IVZk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4529,"size":1995,"noattachment":false,"key":"/array-shuffle/-/array-shuffle-4.0.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=20"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"0b7a90367e53e0a427ffd43c923a2f06f7895f1e","scripts":{"test":"xo && ava"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/array-shuffle.git","type":"git"},"_npmVersion":"10.9.2","description":"Randomize the order of items in an array","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.2","ava":"^6.4.1"},"_npmOperationalInternal":{"tmp":"tmp/array-shuffle_4.0.0_1758255218669_0.8911482476337291","host":"s3://npm-registry-packages-npm-production"},"readme":"# array-shuffle\n\n> Randomize the order of items in an array\n\nUses the [Durstenfeld algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm) which is based on the [Fisher–Yates algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle).\n\n## Install\n\n```sh\nnpm install array-shuffle\n```\n\n## Usage\n\n```js\nimport {arrayToShuffled, arrayShuffle} from 'array-shuffle';\n\n// Create a new shuffled array\nconst shuffled = arrayToShuffled([1, 2, 3, 4, 5, 6]);\n//=> [3, 5, 4, 1, 2, 6]\n\n// Shuffle in-place\nconst array = [1, 2, 3, 4, 5, 6];\narrayShuffle(array);\nconsole.log(array);\n//=> [3, 5, 4, 1, 2, 6]\n```\n\n## API\n\n### arrayToShuffled(array, options?)\n\nCreate a new array with the items randomized (does not mutate the original array).\n\nReturns a new array with the items randomized.\n\n#### array\n\nType: `Array`\n\nThe array to shuffle.\n\n#### options\n\nType: `object`\n\n##### randomNumberGenerator\n\nType: `() => number`\n\nCustom random number generator that returns a float between 0 (inclusive) and 1 (exclusive). This is useful for deterministic shuffling when you use a seeded generator.\n\n```js\nimport {arrayToShuffled} from 'array-shuffle';\n\nconst randomNumberGenerator = () => 0;\nconst deterministic = arrayToShuffled([1, 2, 3, 4, 5, 6], {randomNumberGenerator});\n//=> [2, 3, 4, 5, 6, 1]\n```\n\n### arrayShuffle(array, options?)\n\nRandomize the order of items in an array, mutating the array in-place.\n\nReturns the input array shuffled.\n\n#### array\n\nType: `Array`\n\nThe array to shuffle.\n\n#### options\n\nType: `object`\n\n##### randomNumberGenerator\n\nType: `() => number`\n\nCustom random number generator that returns a float between 0 (inclusive) and 1 (exclusive). This is useful for deterministic shuffling when you use a seeded generator.\n","publish_time":1758255218856,"_cnpm_publish_time":1758255218856,"dist-tags":{"latest":"4.1.0"}}