{"id":23722656,"url":"https://github.com/remko/fy-shuffle","last_synced_at":"2026-02-15T00:30:14.481Z","repository":{"id":23053960,"uuid":"26407204","full_name":"remko/fy-shuffle","owner":"remko","description":"Customizable Fisher-Yates shuffle","archived":false,"fork":false,"pushed_at":"2015-11-24T19:05:13.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T14:36:26.129Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-09T19:57:14.000Z","updated_at":"2017-06-25T22:36:21.000Z","dependencies_parsed_at":"2022-07-23T21:00:30.794Z","dependency_job_id":null,"html_url":"https://github.com/remko/fy-shuffle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remko%2Ffy-shuffle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remko%2Ffy-shuffle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remko%2Ffy-shuffle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remko%2Ffy-shuffle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remko","download_url":"https://codeload.github.com/remko/fy-shuffle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239818064,"owners_count":19702064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-30T23:55:15.536Z","updated_at":"2026-02-15T00:30:14.440Z","avatar_url":"https://github.com/remko.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [fy-shuffle: Customizable Fisher-Yates shuffle](https://el-tramo.be/fy-shuffle)\n\nShuffles an array using the [Fisher-Yates algorithm](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle). The difference between this implementation and others out there is that \nthe shuffle is parameterized with a random number generator function, so it can\nbe used to generate predictable results (using e.g. a [Linear Congruential Generator](http://el-tramo.be/lcg-random/)).\n\n\n## Installation\n\n    npm install fy-shuffle --save\n\n\n## Usage\n\nA call to the exported function returns a shuffled version of the given array.\n\n\tvar fyShuffle = require(\"fy-shuffle\");\n\n\t// Outputs [2, 1, 4, 3], or some permutation of it.\n\tconsole.log(fyShuffle([1, 2, 3, 4]));\n\n\t// Pass a custom random number generator.\n\t// Always outputs [1, 4, 2, 3].\n\tconsole.log(fyShuffle([1, 2, 3, 4], function () { return 0.5; }));\n\n\n## API\n\n### `fyShuffle(array, [random])`\n\nShuffles the given array.\n\n- **`array`** - *array*  \n    Array to shuffle\n\n- **`random`** - *function*  \n    The random number generator function to use. Must return a number between 0.  \n    inclusive and 1 exclusive.  \n    Default: `Math.random`\n\n\n## Project Status\n\n[![Build Status](https://travis-ci.org/remko/fy-shuffle.svg?branch=master)](https://travis-ci.org/remko/fy-shuffle)\n\n[![Coverage Status](https://coveralls.io/repos/remko/fy-shuffle/badge.png?branch=master)](https://coveralls.io/r/remko/fy-shuffle?branch=master)\n\n[![Browser Support](https://ci.testling.com/remko/fy-shuffle.png)\n](https://ci.testling.com/remko/fy-shuffle)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremko%2Ffy-shuffle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremko%2Ffy-shuffle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremko%2Ffy-shuffle/lists"}