{"id":22793103,"url":"https://github.com/kripod/pcg.js","last_synced_at":"2025-06-19T19:35:27.209Z","repository":{"id":81144451,"uuid":"80447802","full_name":"kripod/pcg.js","owner":"kripod","description":"A functional implementation of the PCG family random number generators, written in JavaScript.","archived":false,"fork":false,"pushed_at":"2023-02-06T10:06:57.000Z","size":40,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T17:22:09.735Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kripod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-30T18:01:10.000Z","updated_at":"2022-04-27T00:18:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f281970-25f7-41a4-99c7-567b14abee4b","html_url":"https://github.com/kripod/pcg.js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kripod/pcg.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fpcg.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fpcg.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fpcg.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fpcg.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kripod","download_url":"https://codeload.github.com/kripod/pcg.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kripod%2Fpcg.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260816560,"owners_count":23067325,"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-12T03:18:03.919Z","updated_at":"2025-06-19T19:35:22.202Z","avatar_url":"https://github.com/kripod.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pcg.js\n\n[![NPM](https://img.shields.io/npm/v/pcg.svg)](https://www.npmjs.com/package/pcg)\n[![Travis CI](https://img.shields.io/travis/kripod/pcg.js/master.svg)](https://travis-ci.org/kripod/pcg.js)\n[![Codecov](https://img.shields.io/codecov/c/github/kripod/pcg.js.svg)](https://codecov.io/gh/kripod/pcg.js)\n\nA functional implementation of the [PCG family random number generators](), written in JavaScript.\n\n[PCG family random number generators]: http://pcg-random.org\n\n## Getting started\n\nTo achieve frictionless reproducibility of random output results, immutable objects are used throughout the project.\n\nFirstly, create a random number engine:\n\n```js\nimport { createPcg32 } from 'pcg';\n\nconst advancedOptions = {};\nconst initState = 42;\nconst initStreamId = 54;\nconst pcg = createPcg32(advancedOptions, initState, initStreamId);\n```\n\nAfter that, random outputs can be generated by calling appropriate functions as shown below:\n\n```js\nimport { nextState, prevState, randomInt, randomList } from 'pcg';\n\nconst randomUint32 = randomInt(0, (2 ** 32) - 1);\nlet [value, nextPcg] = randomUint32(pcg);\n\nconst listLength = 6;\nconst listItemRng = randomUint32;\n[value, nextPcg] = randomList(listLength, listItemRng, pcg);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkripod%2Fpcg.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkripod%2Fpcg.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkripod%2Fpcg.js/lists"}