{"id":21890640,"url":"https://github.com/vcgtz/rndjs","last_synced_at":"2025-03-22T03:11:09.947Z","repository":{"id":58540168,"uuid":"531740711","full_name":"vcgtz/rndjs","owner":"vcgtz","description":"Minimal library to generate random values","archived":false,"fork":false,"pushed_at":"2023-04-21T21:22:43.000Z","size":695,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T20:39:33.599Z","etag":null,"topics":["random","random-generator"],"latest_commit_sha":null,"homepage":"","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/vcgtz.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":"2022-09-02T01:26:16.000Z","updated_at":"2022-10-05T01:26:16.000Z","dependencies_parsed_at":"2024-10-20T17:15:28.615Z","dependency_job_id":null,"html_url":"https://github.com/vcgtz/rndjs","commit_stats":{"total_commits":39,"total_committers":1,"mean_commits":39.0,"dds":0.0,"last_synced_commit":"2da1a0304e1bd769ebbebd0362db3523b8e351b5"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcgtz%2Frndjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcgtz%2Frndjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcgtz%2Frndjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcgtz%2Frndjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vcgtz","download_url":"https://codeload.github.com/vcgtz/rndjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244898446,"owners_count":20528341,"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":["random","random-generator"],"created_at":"2024-11-28T12:16:14.240Z","updated_at":"2025-03-22T03:11:09.928Z","avatar_url":"https://github.com/vcgtz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rndjs\nMinimal library to generate random values. (Now with support for TypeScript!)\n\n![npm](https://img.shields.io/npm/l/rndjs?color=blue)\n![npm](https://img.shields.io/npm/v/rndjs)\n![github actions](https://github.com/vcgtz/rndjs/actions/workflows/node.js.yml/badge.svg)\n\n## Installation\nThis module is available through [NPM](https://www.npmjs.com/).\n\nTo install this library, you just need to run:\n```bash\nnpm i rndjs\n```\n\nThen, you can import it en your project:\n```js\nconst rndjs = require('rndjs');\n\n// or\nimport * as rndjs from 'rndjs';\n```\n\n## Available functions\n### `getRandomNumber(): number`\nIt returns a number between 0 and 1.\n```js\nrndjs.getRandomNumber();\n```\n\n### `getRandomNumberBetween(start: number, end: number): number`\nIt returns a random number between two numbers, including them.\n```js\nrndjs.getRandomNumberBetween(10, 25); // It returns a number between 10 and 25\n```\n\n### `getRandomBoolean(): boolean`\nIt returns a random boolean value.\n```js\nrndjs.getRandomBoolean(); // It returns true or false\n```\n\n### `getRandomChar(options?: RandomCharOptions): string`\nIt returns a random character between `a` and `z`. If you pass an object with the attribute `upper: true`, this method returns the uppercase character.\n```js\nrndjs.getRandomChar(); // It returns a char between a-z\nrndjs.getRandomChar({ upper: true }); // It returns a char between A-Z\n```\n\n### `getRandomAdjective(): string`\nIt returns a random adjective.\n```js\nrndjs.getRandomAdjective(); // It returns beautiful for example\n```\n\n### `getRandomRGBColor(): RGB`\nIt returns a random RGB color object. The object has the format `{ r: \u003cnumber\u003e, g: \u003cnumber\u003e, b: \u003cnumber\u003e }`\n```js\nrndjs.getRandomRGBColor(); // It returns an object like {r: 19, g: 110, b: 166}\n```\n\n### `flipACoin(): string`\nIt simulates flip a coin.\n```js\nrndjs.flipACoin(); // It returns 'heads' or 'tails'\n```\n\n### `rollADice(): number`\nIt simulates a dice roll.\n```js\nrndjs.rollADice(); // It returns a number between 1 and 6\n```\n\n## License\n[MIT](https://github.com/vcgtz/rndjs/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvcgtz%2Frndjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvcgtz%2Frndjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvcgtz%2Frndjs/lists"}