{"id":13592910,"url":"https://github.com/acarl005/generatorics","last_synced_at":"2026-02-21T18:36:33.353Z","repository":{"id":57249527,"uuid":"51500935","full_name":"acarl005/generatorics","owner":"acarl005","description":"An efficient combinatorics library for JavaScript utilizing ES2015 generators.","archived":false,"fork":false,"pushed_at":"2017-02-13T02:02:23.000Z","size":28,"stargazers_count":90,"open_issues_count":4,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-24T04:20:24.860Z","etag":null,"topics":["combination","combinatorics","generator","permutation","powerset"],"latest_commit_sha":null,"homepage":"","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/acarl005.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":"2016-02-11T07:49:10.000Z","updated_at":"2024-12-30T21:37:53.000Z","dependencies_parsed_at":"2022-08-31T00:01:44.279Z","dependency_job_id":null,"html_url":"https://github.com/acarl005/generatorics","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/acarl005/generatorics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarl005%2Fgeneratorics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarl005%2Fgeneratorics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarl005%2Fgeneratorics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarl005%2Fgeneratorics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acarl005","download_url":"https://codeload.github.com/acarl005/generatorics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarl005%2Fgeneratorics/sbom","scorecard":{"id":162214,"data":{"date":"2025-08-11","repo":{"name":"github.com/acarl005/generatorics","commit":"a11d286241ac173ad2d323554e3b8b3f97fda2b7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T13:48:52.409Z","repository_id":57249527,"created_at":"2025-08-16T13:48:52.409Z","updated_at":"2025-08-16T13:48:52.409Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29690112,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T18:18:25.093Z","status":"ssl_error","status_checked_at":"2026-02-21T18:18:22.435Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["combination","combinatorics","generator","permutation","powerset"],"created_at":"2024-08-01T16:01:14.626Z","updated_at":"2026-02-21T18:36:33.325Z","avatar_url":"https://github.com/acarl005.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Generatorics\n\n### An efficient combinatorics library for JavaScript utilizing ES2015 generators. Generate combinations, permutations, and power sets of arrays or strings.\n\n- Node\n```\nnpm install generatorics\n```\n```javascript\nvar G = require('generatorics');\n```\n\n- Browser\n```\nbower install generatorics\n```\n```html\n\u003cscript src=\"file/path/to/generatorics.js\"\u003e\u003c/script\u003e\n```\n\n**Note:** This module is not transpiled for compatibility, as it degrades the performance. Check your browser/node version.\n\n## Usage\n\n### power set\n```javascript\nfor (var subset of G.powerSet(['a', 'b', 'c'])) {\n  console.log(subset);\n}\n// [ ]\n// [ 'a' ]\n// [ 'a', 'b' ]\n// [ 'a', 'b', 'c' ]\n// [ 'a', 'c' ]\n// [ 'b' ]\n// [ 'b', 'c' ]\n// [ 'c' ]\n```\n\n### permutation\n```javascript\nfor (var perm of G.permutation(['a', 'b', 'c'], 2)) {\n  console.log(perm);\n}\n// [ 'a', 'b' ]\n// [ 'a', 'c' ]\n// [ 'b', 'a' ]\n// [ 'b', 'c' ]\n// [ 'c', 'a' ]\n// [ 'c', 'b' ]\n\nfor (var perm of G.permutation(['a', 'b', 'c'])) { // assumes full length of array\n  console.log(perm);\n}\n// [ 'a', 'b', 'c' ]\n// [ 'a', 'c', 'b' ]\n// [ 'b', 'a', 'c' ]\n// [ 'b', 'c', 'a' ]\n// [ 'c', 'b', 'a' ]\n// [ 'c', 'a', 'b' ]\n```\n\n### combination\n```javascript\nfor (var comb of G.combination(['a', 'b', 'c'], 2)) {\n  console.log(comb);\n}\n// [ 'a', 'b' ]\n// [ 'a', 'c' ]\n// [ 'b', 'c' ]\n```\n\nFor efficiency, each array being yielded is the same one being mutated on each iteration. **DO NOT** mutate the array.\n```javascript\nvar combs = [];\nfor (var comb of G.combination(['a', 'b', 'c'], 2)) {\n  combs.push(comb);\n}\nconsole.log(combs);\n// [ [ 'b', 'c' ], [ 'b', 'c' ], [ 'b', 'c' ] ]\n```\nYou can clone if necessary, or use the [clone submodule](#clone-submodule)\n\n### permutation of combination\n```javascript\nfor (var perm of G.permutationCombination(['a', 'b', 'c'])) {\n  console.log(perm);\n}\n// [ ]\n// [ 'a' ]\n// [ 'a', 'b' ]\n// [ 'a', 'b', 'c' ]\n// [ 'a', 'c' ]\n// [ 'a', 'c', 'b' ]\n// [ 'b' ]\n// [ 'b', 'a' ]\n// [ 'b', 'a', 'c' ]\n// [ 'b', 'c' ]\n// [ 'b', 'c', 'a' ]\n// [ 'c' ]\n// [ 'c', 'a' ]\n// [ 'c', 'a', 'b' ]\n// [ 'c', 'b' ]\n// [ 'c', 'b', 'a' ]\n```\n\n### cartesian product\n```javascript\nfor (var prod of G.cartesian([0, 1, 2], [0, 10, 20], [0, 100, 200])) {\n  console.log(prod);\n}\n// [ 0, 0, 0 ],  [ 0, 0, 100 ],  [ 0, 0, 200 ]\n// [ 0, 10, 0 ], [ 0, 10, 100 ], [ 0, 10, 200 ]\n// [ 0, 20, 0 ], [ 0, 20, 100 ], [ 0, 20, 200 ]\n// [ 1, 0, 0 ],  [ 1, 0, 100 ],  [ 1, 0, 200 ]\n// [ 1, 10, 0 ], [ 1, 10, 100 ], [ 1, 10, 200 ]\n// [ 1, 20, 0 ], [ 1, 20, 100 ], [ 1, 20, 200 ]\n// [ 2, 0, 0 ],  [ 2, 0, 100 ],  [ 2, 0, 200 ]\n// [ 2, 10, 0 ], [ 2, 10, 100 ], [ 2, 10, 200 ]\n// [ 2, 20, 0 ], [ 2, 20, 100 ], [ 2, 20, 200 ]\n```\n\n### base N\n```javascript\nfor (var num of G.baseN(['a', 'b', 'c'])) {\n  console.log(num);\n}\n// [ 'a', 'a', 'a' ], [ 'a', 'a', 'b' ], [ 'a', 'a', 'c' ]\n// [ 'a', 'b', 'a' ], [ 'a', 'b', 'b' ], [ 'a', 'b', 'c' ]\n// [ 'a', 'c', 'a' ], [ 'a', 'c', 'b' ], [ 'a', 'c', 'c' ]\n// [ 'b', 'a', 'a' ], [ 'b', 'a', 'b' ], [ 'b', 'a', 'c' ]\n// [ 'b', 'b', 'a' ], [ 'b', 'b', 'b' ], [ 'b', 'b', 'c' ]\n// [ 'b', 'c', 'a' ], [ 'b', 'c', 'b' ], [ 'b', 'c', 'c' ]\n// [ 'c', 'a', 'a' ], [ 'c', 'a', 'b' ], [ 'c', 'a', 'c' ]\n// [ 'c', 'b', 'a' ], [ 'c', 'b', 'b' ], [ 'c', 'b', 'c' ]\n// [ 'c', 'c', 'a' ], [ 'c', 'c', 'b' ], [ 'c', 'c', 'c' ]\n```\n\n## Clone Submodule\nEach array yielded from the generator is actually the same array in memory, just mutated to have different elements. This is to avoid the unnecessary creation of a bunch of arrays, which consume memory. As a result, you get a strange result when trying to generate an array.\n```javascript\nvar combs = G.combination(['a', 'b', 'c'], 2);\nconsole.log([...combs]);\n// [ [ 'b', 'c' ], [ 'b', 'c' ], [ 'b', 'c' ] ]\n```\nInstead, you can use the clone submodule.\n```javascript\nvar combs = G.clone.combination(['a', 'b', 'c'], 2);\nconsole.log([...combs]);\n// [ [ 'a', 'b' ], [ 'a', 'c' ], [ 'b', 'c' ] ]\n```\n\n### G.clone\nThis submodule produces generators that yield a different array on each iteration in case you need to mutate it. The [combination](#module_G.combination), [permutation](#module_G.permutation), [powerSet](#module_G.powerSet), [permutationCombination](#module_G.permutationCombination), [baseN](#module_G.baseN), [baseNAll](#module_G.baseNAll), and [cartesian](#module_G.cartesian) methods are provided on this submodule.\n\n## Cool things to do with ES2015 generators\n```javascript\nvar combs = G.clone.combination([1, 2, 3], 2);\n\n// \"for-of\" loop\nfor (let comb of combs) {\n  console.log(comb);\n}\n\n// generate arrays\nArray.from(combs);\n[...combs];\n\n// generate sets\nnew Set(combs);\n\n// spreading in function calls\nconsole.log(...combs);\n```\n\n#### Writing a code generator? Need to produce an infinite stream of minified variable names?\n\nNo problem! Just pass in a collection of all your valid characters and start generating.\n\n```javascript\nvar mininym = G.baseNAll('abcdefghijklmnopqrstuvwxyz$#')\nvar name = mininym.next().value.join('')\nglobal[name] = 'some value'\n```\n\n#### Card games anyone?\n```javascript\nvar cards = [...G.clone.cartesian('♠♥♣♦', 'A23456789JQK')];\nconsole.log(G.shuffle(cards));\n// [ [ '♦', '6' ], [ '♠', '6' ], [ '♣', '7' ], [ '♥', 'K' ],\n//   [ '♣', 'J' ], [ '♥', '4' ], [ '♦', '2' ], [ '♥', '9' ],\n//   [ '♦', 'Q' ], [ '♠', 'Q' ], [ '♠', '4' ], [ '♠', 'K' ],\n//   [ '♥', '3' ], [ '♥', '7' ], [ '♠', '5' ], [ '♦', '7' ],\n//   [ '♥', '5' ], [ '♣', 'Q' ], [ '♣', '9' ], [ '♠', 'A' ],\n//   [ '♣', '4' ], [ '♣', '3' ], [ '♥', 'A' ], [ '♥', '8' ],\n//   [ '♣', '8' ], [ '♦', '8' ], [ '♠', '8' ], [ '♣', '5' ],\n//   [ '♥', '2' ], [ '♥', 'Q' ], [ '♦', 'A' ], [ '♥', '6' ],\n//   [ '♠', '2' ], [ '♣', '6' ], [ '♠', '3' ], [ '♦', 'K' ],\n//   [ '♦', 'J' ], [ '♠', '7' ], [ '♥', 'J' ], [ '♦', '5' ],\n//   [ '♦', '9' ], [ '♦', '3' ], [ '♠', '9' ], [ '♣', '2' ],\n//   [ '♣', 'A' ], [ '♣', 'K' ], [ '♦', '4' ], [ '♠', 'J' ] ]\n```\n\n## Documentation\n\u003ca name=\"module_G\"\u003e\u003c/a\u003e\n\n## G\n\n* [G](#module_G)\n    * [.factorial(n)](#module_G.factorial) ⇒ \u003ccode\u003eNumber\u003c/code\u003e\n    * [.factoradic(n)](#module_G.factoradic) ⇒ \u003ccode\u003eArray\u003c/code\u003e\n    * [.P(n, k)](#module_G.P) ⇒ \u003ccode\u003eNumber\u003c/code\u003e\n    * [.C(n, k)](#module_G.C) ⇒ \u003ccode\u003eNumber\u003c/code\u003e\n    * [.choices(n, k, [options])](#module_G.choices) ⇒ \u003ccode\u003eNumber\u003c/code\u003e\n    * [.combination(arr, [size])](#module_G.combination) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\n    * [.permutation(arr, [size])](#module_G.permutation) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\n    * [.powerSet(arr)](#module_G.powerSet) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\n    * [.permutationCombination(arr)](#module_G.permutationCombination) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\n    * [.baseN(arr, [size])](#module_G.baseN) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\n    * [.baseNAll(arr)](#module_G.baseNAll) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\n    * [.cartesian(...sets)](#module_G.cartesian) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\n    * [.shuffle(arr)](#module_G.shuffle) ⇒ \u003ccode\u003eArray\u003c/code\u003e\n\n\u003ca name=\"module_G.factorial\"\u003e\u003c/a\u003e\n\n### G.factorial(n) ⇒ \u003ccode\u003eNumber\u003c/code\u003e\nCalculates a factorial\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eNumber\u003c/code\u003e - n!  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| n | \u003ccode\u003eNumber\u003c/code\u003e | The number to operate the factorial on. |\n\n\u003ca name=\"module_G.factoradic\"\u003e\u003c/a\u003e\n\n### G.factoradic(n) ⇒ \u003ccode\u003eArray\u003c/code\u003e\nConverts a number to the factorial number system. Digits are in least significant order.\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eArray\u003c/code\u003e - digits of n in factoradic in least significant order  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| n | \u003ccode\u003eNumber\u003c/code\u003e | Integer in base 10 |\n\n\u003ca name=\"module_G.P\"\u003e\u003c/a\u003e\n\n### G.P(n, k) ⇒ \u003ccode\u003eNumber\u003c/code\u003e\nCalculates the number of possible permutations of \"k\" elements in a set of size \"n\".\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eNumber\u003c/code\u003e - n P k  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| n | \u003ccode\u003eNumber\u003c/code\u003e | Number of elements in the set. |\n| k | \u003ccode\u003eNumber\u003c/code\u003e | Number of elements to choose from the set. |\n\n\u003ca name=\"module_G.C\"\u003e\u003c/a\u003e\n\n### G.C(n, k) ⇒ \u003ccode\u003eNumber\u003c/code\u003e\nCalculates the number of possible combinations of \"k\" elements in a set of size \"n\".\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eNumber\u003c/code\u003e - n C k  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| n | \u003ccode\u003eNumber\u003c/code\u003e | Number of elements in the set. |\n| k | \u003ccode\u003eNumber\u003c/code\u003e | Number of elements to choose from the set. |\n\n\u003ca name=\"module_G.choices\"\u003e\u003c/a\u003e\n\n### G.choices(n, k, [options]) ⇒ \u003ccode\u003eNumber\u003c/code\u003e\nHigher level method for counting number of possible combinations of \"k\" elements from a set of size \"n\".\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eNumber\u003c/code\u003e - Number of possible combinations.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| n | \u003ccode\u003eNumber\u003c/code\u003e | Number of elements in the set. |\n| k | \u003ccode\u003eNumber\u003c/code\u003e | Number of elements to choose from the set. |\n| [options] | \u003ccode\u003eObject\u003c/code\u003e |  |\n| options.replace | \u003ccode\u003eBoolean\u003c/code\u003e | Is replacement allowed after each choice? |\n| options.ordered | \u003ccode\u003eBoolean\u003c/code\u003e | Does the order of the choices matter? |\n\n\u003ca name=\"module_G.combination\"\u003e\u003c/a\u003e\n\n### G.combination(arr, [size]) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\nGenerates all combinations of a set.\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eGenerator\u003c/code\u003e - yields each combination as an array  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| arr | \u003ccode\u003eArray\u003c/code\u003e \u0026#124; \u003ccode\u003eString\u003c/code\u003e |  | The set of elements. |\n| [size] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003earr.length\u003c/code\u003e | Number of elements to choose from the set. |\n\n\u003ca name=\"module_G.permutation\"\u003e\u003c/a\u003e\n\n### G.permutation(arr, [size]) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\nGenerates all permutations of a set.\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eGenerator\u003c/code\u003e - yields each permutation as an array  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| arr | \u003ccode\u003eArray\u003c/code\u003e \u0026#124; \u003ccode\u003eString\u003c/code\u003e |  | The set of elements. |\n| [size] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003earr.length\u003c/code\u003e | Number of elements to choose from the set. |\n\n\u003ca name=\"module_G.powerSet\"\u003e\u003c/a\u003e\n\n### G.powerSet(arr) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\nGenerates all possible subsets of a set (a.k.a. power set).\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eGenerator\u003c/code\u003e - yields each subset as an array  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| arr | \u003ccode\u003eArray\u003c/code\u003e \u0026#124; \u003ccode\u003eString\u003c/code\u003e | The set of elements. |\n\n\u003ca name=\"module_G.permutationCombination\"\u003e\u003c/a\u003e\n\n### G.permutationCombination(arr) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\nGenerates the permutation of the combinations of a set.\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eGenerator\u003c/code\u003e - yields each permutation as an array  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| arr | \u003ccode\u003eArray\u003c/code\u003e \u0026#124; \u003ccode\u003eString\u003c/code\u003e | The set of elements. |\n\n\u003ca name=\"module_G.baseN\"\u003e\u003c/a\u003e\n\n### G.baseN(arr, [size]) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\nGenerates all possible \"numbers\" from the digits of a set.\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eGenerator\u003c/code\u003e - yields all digits as an array  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| arr | \u003ccode\u003eArray\u003c/code\u003e \u0026#124; \u003ccode\u003eString\u003c/code\u003e |  | The set of digits. |\n| [size] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003earr.length\u003c/code\u003e | How many digits will be in the numbers. |\n\n\u003ca name=\"module_G.baseNAll\"\u003e\u003c/a\u003e\n\n### G.baseNAll(arr) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\nInfinite generator for all possible \"numbers\" from a set of digits.\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eGenerator\u003c/code\u003e - yields all digits as an array  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| arr | \u003ccode\u003eArray\u003c/code\u003e \u0026#124; \u003ccode\u003eString\u003c/code\u003e | The set of digits |\n\n\u003ca name=\"module_G.cartesian\"\u003e\u003c/a\u003e\n\n### G.cartesian(...sets) ⇒ \u003ccode\u003eGenerator\u003c/code\u003e\nGenerates the cartesian product of the sets.\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eGenerator\u003c/code\u003e - yields each product as an array  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| ...sets | \u003ccode\u003eArray\u003c/code\u003e \u0026#124; \u003ccode\u003eString\u003c/code\u003e | variable number of sets of n elements. |\n\n\u003ca name=\"module_G.shuffle\"\u003e\u003c/a\u003e\n\n### G.shuffle(arr) ⇒ \u003ccode\u003eArray\u003c/code\u003e\nShuffles an array in place using the Fisher–Yates shuffle.\n\n**Kind**: static method of \u003ccode\u003e[G](#module_G)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eArray\u003c/code\u003e - a random, unbiased perutation of arr  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| arr | \u003ccode\u003eArray\u003c/code\u003e | A set of elements. |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facarl005%2Fgeneratorics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facarl005%2Fgeneratorics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facarl005%2Fgeneratorics/lists"}