{"id":17398451,"url":"https://github.com/vweevers/pseudo-random-buffer","last_synced_at":"2026-05-18T02:35:12.872Z","repository":{"id":65477274,"uuid":"189762781","full_name":"vweevers/pseudo-random-buffer","owner":"vweevers","description":"Get a random buffer based on a seed. Fast, not secure.","archived":false,"fork":false,"pushed_at":"2020-05-25T04:08:57.000Z","size":9,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T04:39:05.528Z","etag":null,"topics":["bytes","nodejs","random","xorshift"],"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/vweevers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-01T17:56:29.000Z","updated_at":"2019-09-06T11:42:06.000Z","dependencies_parsed_at":"2023-01-25T06:35:16.670Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/pseudo-random-buffer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vweevers/pseudo-random-buffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fpseudo-random-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fpseudo-random-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fpseudo-random-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fpseudo-random-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/pseudo-random-buffer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fpseudo-random-buffer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33162675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bytes","nodejs","random","xorshift"],"created_at":"2024-10-16T14:56:40.372Z","updated_at":"2026-05-18T02:35:12.837Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pseudo-random-buffer\n\n\u003e **Get a random buffer based on a seed. Fast, not secure.**  \n\u003e Useful for reproducible tests and benchmarks. Same API as [`random-bytes-seed`](https://github.com/mafintosh/random-bytes-seed) which uses [`crypto`](https://nodejs.org/api/crypto.html) (secure) while this uses [xorshift128+](https://github.com/AndreasMadsen/xorshift) (10-25x faster). See also [`pseudo-math-random`](https://github.com/vweevers/pseudo-math-random).\n\n[![npm status](http://img.shields.io/npm/v/pseudo-random-buffer.svg)](https://www.npmjs.org/package/pseudo-random-buffer)\n[![node](https://img.shields.io/node/v/pseudo-random-buffer.svg)](https://www.npmjs.org/package/pseudo-random-buffer)\n[![Travis build status](https://img.shields.io/travis/vweevers/pseudo-random-buffer.svg?label=travis)](http://travis-ci.org/vweevers/pseudo-random-buffer)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Usage\n\n```js\nconst prb = require('pseudo-random-buffer')\nconst randomBytes = prb('a seed')\n\nconsole.log(randomBytes(4)) // \u003cBuffer a3 e5 40 54\u003e\nconsole.log(randomBytes(3)) // \u003cBuffer 09 14 6b\u003e\n```\n\nThis example will always log the same bytes, unless you change the seed.\n\n## API\n\n### `randomBytes = prb([seed])`\n\nCreate a new random bytes generator. The `seed` argument must be a string or [Buffer](https://nodejs.org/api/buffer.html). It is hashed once to counter short or zero-filled seeds. If no seed is provided one will be generated.\n\n### `buf = randomBytes(length)`\n\nGet a buffer with pseudo random bytes.\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install pseudo-random-buffer\n```\n\n## Benchmark\n\n```\n$ node benchmark.js 1024\nnode v10.14.1, n=1024\n\npseudo-random-buffer x 166,796 ops/sec ±1.68% (86 runs sampled)\nrandom-bytes-seed x 13,477 ops/sec ±2.08% (76 runs sampled)\n\nFastest is pseudo-random-buffer\n```\n\n_NB. Speed isn't everything. Decide for yourself which properties you need._\n\n## License\n\n[MIT](LICENSE.md) © 2019-present Vincent Weevers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fpseudo-random-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fpseudo-random-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fpseudo-random-buffer/lists"}