{"name":"array-shuffle","version":"4.1.0","description":"Randomize the order of items in an array","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/array-shuffle.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=20"},"scripts":{"test":"xo && ava"},"keywords":["array","list","shuffle","sort","random","rand","fisher","yates","durstenfeld"],"devDependencies":{"ava":"^6.4.1","xo":"^1.2.2"},"gitHead":"7a3bd16755529d8b2caebe357a74d71a7e5f022c","types":"./index.d.ts","_id":"array-shuffle@4.1.0","bugs":{"url":"https://github.com/sindresorhus/array-shuffle/issues"},"homepage":"https://github.com/sindresorhus/array-shuffle#readme","_nodeVersion":"25.3.0","_npmVersion":"11.7.0","dist":{"integrity":"sha512-VeSwSNI0y9NojZ/seTJujlyO2xQCwdfn5ujU2ji+VaHos2z4u88aqy6nCVIJhmaMTOQvqNyIWwOJ/pSlYjPhTQ==","shasum":"32a967bc99186c3df40c36efdeb2b4dd504d89fa","tarball":"http://registry-npm.ywwl.com/array-shuffle/download/array-shuffle-4.1.0.tgz","fileCount":5,"unpackedSize":6730,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE6RrAuAy4/vMUp2/y/BUHIgDe5JWv0jDMFoyAUUN4I/AiAv4lyalx8mBZIK74Sm25jO0MoMCGMQ2C7VkjDINdggCg=="}],"size":2402,"noattachment":false,"key":"/array-shuffle/-/array-shuffle-4.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/array-shuffle_4.1.0_1770061102744_0.1322758605929597"},"_hasShrinkwrap":false,"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":1770061102899,"_cnpm_publish_time":1770061102899,"dist-tags":{"latest":"4.1.0"}}