{"id":20716653,"url":"https://github.com/jurerotar/ts-seedrandom","last_synced_at":"2026-03-01T17:04:20.332Z","repository":{"id":257812571,"uuid":"868267053","full_name":"jurerotar/ts-seedrandom","owner":"jurerotar","description":"Seeded random number generators for TypeScript.","archived":false,"fork":false,"pushed_at":"2026-02-02T08:58:22.000Z","size":188,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-02T21:36:50.955Z","etag":null,"topics":["alea","arc4","mulberry32","park-miller","prng","prng-algorithms","random-generation","sfc","splitmix","typescript","xoroshiro","xorshift"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/ts-seedrandom","language":"TypeScript","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/jurerotar.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-05T23:08:01.000Z","updated_at":"2026-02-02T08:56:07.000Z","dependencies_parsed_at":"2025-10-18T15:18:13.800Z","dependency_job_id":"5f1e64f1-58a7-4ed3-9141-3346c954f19f","html_url":"https://github.com/jurerotar/ts-seedrandom","commit_stats":null,"previous_names":["jurerotar/ts-seedrandom"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/jurerotar/ts-seedrandom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurerotar%2Fts-seedrandom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurerotar%2Fts-seedrandom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurerotar%2Fts-seedrandom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurerotar%2Fts-seedrandom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jurerotar","download_url":"https://codeload.github.com/jurerotar/ts-seedrandom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jurerotar%2Fts-seedrandom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29976272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["alea","arc4","mulberry32","park-miller","prng","prng-algorithms","random-generation","sfc","splitmix","typescript","xoroshiro","xorshift"],"created_at":"2024-11-17T03:06:26.106Z","updated_at":"2026-03-01T17:04:20.326Z","avatar_url":"https://github.com/jurerotar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ts-seedrandom\n\nSeeded random number generators for TypeScript.\n\n## Installation\n\n```shell\nnpm install ts-seedrandom\n```\n\n## Usage\n\nEach generator includes the following methods:\n* `quick` - Default method used. Provides 32 bits of randomness in a float. Can either be called by calling generator instance directly (ex. `generator()`) or by name (ex. `generator.quick()`).\n* `double` - Provides 56 bits of randomness.\n* `int32` - Providers a 32 bit (signed) integer.\n* `state` - Provides internal generator state. Used for saving and restoring states.\n\n```ts\nimport { prngAlea } from 'ts-seedrandom';\n\nconst aleaGenerator = prngAlea('seed');\nconst firstValue = aleaGenerator();\nconst secondValue = aleaGenerator();\n```\n\nYou also have the option of saving and restoring state of your generator.\n\n```ts\nimport { prngAlea } from 'ts-seedrandom';\n\nconst aleaGenerator = prngAlea('seed');\nconst firstValue = aleaGenerator();\n\n// Return internal generator state, which you can use in other generator instances\nconst state = aleaGenerator.state();\n\n// This generator starts from the same state as first generator, but runs independently\nconst secondAleaGenerator = prngAlea('seed', state);\n```\n\n## Available Algorithms\n\nThe following PRNG algorithms are available:\n\n1. `prngAlea`: Alea algorithm\n2. `prngArc4`: ARC4 algorithm\n3. `prngTychei`: Tyche-i algorithm\n4. `prngXor128`: XorShift128 algorithm\n5. `prngXor4096`: XorShift4096 algorithm\n6. `prngXorshift7`: XorShift7 algorithm\n7. `prngXorwow`: Xorwow algorithm\n8. `prngMulberry32`: Mulberry 32 algorithm\n9. `prngXoshiro128Plus`: Xoshiro128+ algorithm\n10. `prngXoshiro128PlusPlus`: Xoshiro128++ algorithm\n11. `prngSplitMix64`: SplitMix64 algorithm\n12. `prngSplitMix32`: SplitMix32 algorithm\n13. `prngSfc32`: SFC32 algorithm\n14. `prngJsf32`: JSF32 algorithm\n15. `prngXoroshiro128ss`: Xoshiro128** algorithm\n16. `prngXoroshiro128+`: Xoroshiro128plus algorithm\n16. `prngParkMiller`: Lehrer (Park-Miller) algorithm\n\nYou can import and use any of these algorithms in the same way as demonstrated in the usage examples above.\n\n### Algorithm comparison (fastest → slowest)\n\n| Name | State Size | Time for 1M iters (ms) | Speed (Mops/s) | Per-iter (ns) | × slower | Slower vs fastest |\n| ---- | ---------- | ---------------------: | -------------: | ------------: | -------: | ----------------: |\n| `xor128` | 128 bits | 10.26 | 97.42 | 10.26 | 1.00× | 0.0% |\n| `xor4096` | 4096 bits | 10.33 | 96.83 | 10.33 | 1.01× | 0.6% |\n| `xorwow` | 192 bits | 11.80 | 84.71 | 11.80 | 1.15× | 15.0% |\n| `xorshift7` | 256 bits | 12.39 | 80.74 | 12.39 | 1.21× | 20.7% |\n| `splitMix32` | 32 bits | 13.45 | 74.35 | 13.45 | 1.31× | 31.0% |\n| `mulberry32` | 32 bits | 13.62 | 73.44 | 13.62 | 1.33× | 32.6% |\n| `tychei` | 128 bits | 15.75 | 63.51 | 15.75 | 1.53× | 53.4% |\n| `xoshiro128+` | 128 bits | 16.08 | 62.19 | 16.08 | 1.57× | 56.7% |\n| `xoshiro128++` | 128 bits | 16.99 | 58.86 | 16.99 | 1.66× | 65.5% |\n| `parkMiller` | 31 bits | 17.48 | 57.20 | 17.48 | 1.70× | 70.3% |\n| `alea` | ~96 bits | 19.01 | 52.60 | 19.01 | 1.85× | 85.2% |\n| `sfc32` | 128 bits | 26.01 | 38.45 | 26.01 | 2.53× | 153.4% |\n| `jsf32` | 128 bits | 37.41 | 26.73 | 37.41 | 3.64× | 264.4% |\n| `arc4` | 2048 bits | 86.60 | 11.55 | 86.60 | 8.44× | 743.7% |\n| `pcg32` | 128 bits | 156.63 | 6.38 | 156.63 | 15.26× | 1425.8% |\n| `xoroshiro128plus` | 128 bits | 261.90 | 3.82 | 261.90 | 25.51× | 2451.4% |\n| `xoroshiro128ss` | 128 bits | 373.66 | 2.68 | 373.66 | 36.40× | 3540.2% |\n| `splitmix64` | 64 bits | 632.14 | 1.58 | 632.14 | 61.58× | 6058.2% |\n\n---\n\n## Notes on the numbers\n\n* **What I computed:**\n\n  * `Mops/s (million iters/sec) = 1000 / (time_ms)`\n  * `per-iteration (ns) ≈ time_ms`\n  * `Slower vs fastest (%) = (1 - (current_speed / fastest_speed)) * 100`.\n* **Test details / machine:** **Lenovo Legion 5 Pro 16ACH6H** (Ryzen 7 5800H — 8 cores / 16 threads, base ≈ 3.2 GHz, turbo ≈ 4.4 GHz, DDR4-3200 memory); Node.js v24.10.0.\n* **Why numbers vary:** JIT warm-up, Node version, single vs multi-thread scheduling, background load, and micro-optimizations in each PRNG implementation all affect timings. Use these as a relative ranking on this machine, not an absolute cross-platform benchmark.\n* You can replicate this exact table by running `npm run compare:performance`\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjurerotar%2Fts-seedrandom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjurerotar%2Fts-seedrandom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjurerotar%2Fts-seedrandom/lists"}