{"id":21238697,"url":"https://github.com/shahradelahi/rand","last_synced_at":"2025-04-06T04:08:47.178Z","repository":{"id":279458733,"uuid":"821293105","full_name":"shahradelahi/rand","owner":"shahradelahi","description":"Random string and number generator.","archived":false,"fork":false,"pushed_at":"2025-03-29T08:06:20.000Z","size":81,"stargazers_count":80,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T09:20:18.528Z","etag":null,"topics":["javascript","random","uuidv4"],"latest_commit_sha":null,"homepage":"https://npmjs.com/@se-oss/rand","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/shahradelahi.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":"2024-06-28T08:11:19.000Z","updated_at":"2025-03-18T03:38:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"d1a0e15a-8365-49c3-94a5-c181ede7b357","html_url":"https://github.com/shahradelahi/rand","commit_stats":null,"previous_names":["shahradelahi/rand"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahradelahi%2Frand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahradelahi%2Frand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahradelahi%2Frand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahradelahi%2Frand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shahradelahi","download_url":"https://codeload.github.com/shahradelahi/rand/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430868,"owners_count":20937874,"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":["javascript","random","uuidv4"],"created_at":"2024-11-21T00:37:47.994Z","updated_at":"2025-04-06T04:08:47.162Z","avatar_url":"https://github.com/shahradelahi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @se-oss/rand\n\n[![CI](https://github.com/shahradelahi/rand/actions/workflows/ci.yml/badge.svg)](https://github.com/shahradelahi/rand/actions/workflows/ci.yml)\n[![NPM Version](https://img.shields.io/npm/v/@se-oss/rand.svg)](https://www.npmjs.com/package/@se-oss/rand)\n[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](/LICENSE)\n[![Install Size](https://packagephobia.com/badge?p=@se-oss/rand)](https://packagephobia.com/result?p=@se-oss/rand)\n\nThis library provides functions for generating random strings and numbers in various formats, including Base10, Base36, Base62, UUIDv4, and random numbers within specified ranges or lengths.\n\n---\n\n- [Installation](#-installation)\n- [Usage](#-usage)\n- [Documentation](#-documentation)\n- [Contributing](#-contributing)\n- [License](#license)\n\n## 📦 Installation\n\n```bash\npnpm i @se-oss/rand\n```\n\n## 📖 Usage\n\n```typescript\nimport * as rnd from '@se-oss/rand';\n\n// Generate a random Base62 string of length 12\nconsole.log(rnd.randomBase62(12)); // Example output: 'A1b2C3d4E5f6'\n\n// Generate a random Base36 string of length 8\nconsole.log(rnd.randomBase36(8)); // Example output: '1a2b3c4d'\n\n// Generate a random Base10 string of length 4\nconsole.log(rnd.randomBase10(4)); // Example output: '5678'\n\n// Generate a random UUIDv4 string\nconsole.log(rnd.randomUuidv4()); // Example output: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'\n\n// Generate a random number between 1 and 10\nconsole.log(rnd.randomNumber(1, 10)); // Example output: 5\n\n// Generate a random number of length 16\nconsole.log(rnd.randomNumber(16)); // Example output: 8933580352864351\n```\n\n## 📚 Documentation\n\nFor all configuration options, please see [the API docs](https://www.jsdocs.io/package/@se-oss/rand).\n\n##### API\n\n```typescript\n// Generates a random string of a specified length using the provided characters.\nfunction random(chars: string, length: number): string;\n\n// Generates a random string of a specified length using Base62 characters (A-Z, a-z, 0-9).\nfunction randomBase62(length: number): string;\n\n// Generates a random string of a specified length using Base36 characters (a-z, 0-9).\nfunction randomBase36(length: number): string;\n\n// Generates a random string of a specified length using Base10 characters (0-9).\nfunction randomBase10(length: number): string;\n\n// Generates a random UUIDv4 string.\nfunction randomUuidv4(): string;\n\n// Generates a random number within a specified range or of a specified length.\nfunction randomNumber(min: number, max: number): number;\nfunction randomNumber(length: number): number;\n```\n\n## 🤝 Contributing\n\nWant to contribute? Awesome! To show your support is to star the project, or to raise issues on [GitHub](https://github.com/shahradelahi/rand).\n\nThanks again for your support, it is much appreciated! 🙏\n\n## License\n\n[MIT](/LICENSE) © [Shahrad Elahi](https://github.com/shahradelahi) and [contributors](https://github.com/shahradelahi/rand/graphs/contributors).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahradelahi%2Frand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshahradelahi%2Frand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahradelahi%2Frand/lists"}