{"id":13408077,"url":"https://github.com/sindresorhus/random-int","last_synced_at":"2025-04-06T20:12:43.295Z","repository":{"id":34252885,"uuid":"38136881","full_name":"sindresorhus/random-int","owner":"sindresorhus","description":"Generate a random integer","archived":false,"fork":false,"pushed_at":"2021-04-17T18:02:19.000Z","size":12,"stargazers_count":87,"open_issues_count":1,"forks_count":16,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-29T05:23:23.658Z","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/sindresorhus.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},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2015-06-26T22:23:26.000Z","updated_at":"2025-03-10T10:42:38.000Z","dependencies_parsed_at":"2022-08-03T20:00:37.817Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/random-int","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Frandom-int","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Frandom-int/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Frandom-int/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Frandom-int/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/random-int/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332555,"owners_count":20921853,"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-07-30T20:00:50.603Z","updated_at":"2025-04-06T20:12:43.268Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# random-int\n\n\u003e Generate a random integer\n\n## Install\n\n```\n$ npm install random-int\n```\n\n## Usage\n\n```js\nimport randomInteger from 'random-int';\n\nrandomInteger(5);\n//=\u003e 3\n\nrandomInteger(10, 100);\n//=\u003e 54\n```\n\n## API\n\n### randomInteger(maximum?)\n\nReturns an integer from `0` to `maximum`.\n\n### randomInteger(minimum, maximum)\n\nReturns an integer from `minimum` to `maximum`.\n\n#### minimum\n\nType: `number`\\\nDefault: `0`\n\nMinimum integer to return.\n\n#### maximum\n\nType: `number`\\\nDefault: `1`\n\nMaximum integer to return.\n\n## Related\n\n- [random-float](https://github.com/sindresorhus/random-float) - Generate a random float\n- [random-item](https://github.com/sindresorhus/random-item) - Get a random item from an array\n- [random-obj-key](https://github.com/sindresorhus/random-obj-key) - Get a random key from an object\n- [random-obj-prop](https://github.com/sindresorhus/random-obj-prop) - Get a random property from an object\n- [unique-random](https://github.com/sindresorhus/unique-random) - Generate random numbers that are consecutively unique\n- [unique-random-array](https://github.com/sindresorhus/unique-random-array) - Get consecutively unique elements from an array\n- [crypto-random-string](https://github.com/sindresorhus/crypto-random-string) - Generate a cryptographically strong random string\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["Packages","Repository","包","Javascript Libraries","目录","others","Number","JavaScript"],"sub_categories":["Number","数字","Text","数量"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Frandom-int","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Frandom-int","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Frandom-int/lists"}