{"id":17398457,"url":"https://github.com/vweevers/uniform-integer","last_synced_at":"2026-05-18T19:38:44.631Z","repository":{"id":57386216,"uuid":"189760308","full_name":"vweevers/uniform-integer","owner":"vweevers","description":"Get an integer between a min and max, bring your own random number generator.","archived":false,"fork":false,"pushed_at":"2020-05-25T04:08:42.000Z","size":10,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-30T06:57:46.653Z","etag":null,"topics":["nodejs","number-generator","random","uniform-distribution"],"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:30:39.000Z","updated_at":"2024-04-27T14:56:25.000Z","dependencies_parsed_at":"2022-09-02T01:11:23.158Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/uniform-integer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vweevers/uniform-integer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Funiform-integer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Funiform-integer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Funiform-integer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Funiform-integer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/uniform-integer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Funiform-integer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273066642,"owners_count":25039634,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"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":["nodejs","number-generator","random","uniform-distribution"],"created_at":"2024-10-16T14:56:50.489Z","updated_at":"2026-05-18T19:38:39.581Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# uniform-integer\n\n\u003e **Get an integer between a min and max, bring your own random number generator.**  \n\u003e See also [`zipfian-integer`](https://github.com/vweevers/zipfian-integer).\n\n[![npm status](http://img.shields.io/npm/v/uniform-integer.svg)](https://www.npmjs.org/package/uniform-integer)\n[![node](https://img.shields.io/node/v/uniform-integer.svg)](https://www.npmjs.org/package/uniform-integer)\n[![Travis build status](https://img.shields.io/travis/vweevers/uniform-integer.svg?label=travis)](http://travis-ci.org/vweevers/uniform-integer)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Usage\n\n```js\nconst uniform = require('uniform-integer')\nconst sample = uniform(1, 100)\n\nconsole.log(sample())\nconsole.log(sample())\n```\n\nThis logs two random integers between 1 and 100 (inclusive). You can optionally inject a (seeded) random number generator. The following example always returns the same integers in sequence unless you change the seed:\n\n```js\nconst random = require('pseudo-math-random')('a seed')\nconst sample = uniform(1, 100, random)\n```\n\n## API\n\n### `sample = uniform(min, max[, rng])`\n\nCreate a new random number generator with a uniform distribution. The `rng` if provided must be a function that returns a random floating-point number between 0 (inclusive) and 1 (exclusive). It defaults to [`Math.random`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random).\n\n### `num = sample()`\n\nGet a random integer between `min` (inclusive) and `max` (inclusive).\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install uniform-integer\n```\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%2Funiform-integer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Funiform-integer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Funiform-integer/lists"}