{"id":15474788,"url":"https://github.com/one20/tabletop-dice","last_synced_at":"2025-04-22T14:08:55.971Z","repository":{"id":51931620,"uuid":"180240386","full_name":"one20/tabletop-dice","owner":"one20","description":"Dice is a javascript module that provides helper functions to simulate various dice types used in tabletop games.","archived":false,"fork":false,"pushed_at":"2022-12-30T17:44:44.000Z","size":39,"stargazers_count":14,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T14:08:50.187Z","etag":null,"topics":["dice","es6","javascript","mocha","polyhedral"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tabletop-dice","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/one20.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-08T22:09:04.000Z","updated_at":"2019-06-12T22:36:03.000Z","dependencies_parsed_at":"2023-01-31T12:20:19.186Z","dependency_job_id":null,"html_url":"https://github.com/one20/tabletop-dice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/one20%2Ftabletop-dice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/one20%2Ftabletop-dice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/one20%2Ftabletop-dice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/one20%2Ftabletop-dice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/one20","download_url":"https://codeload.github.com/one20/tabletop-dice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250255697,"owners_count":21400410,"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":["dice","es6","javascript","mocha","polyhedral"],"created_at":"2024-10-02T03:04:26.330Z","updated_at":"2025-04-22T14:08:55.952Z","avatar_url":"https://github.com/one20.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dice\n\n## Contents\n* [Summary](#summary)\n* [Methods](#methods)\n* [Usage](#usage)\n\n## Summary\n`Dice` is a module that provides helper functions to simulate various \ndice types used in tabletop games. This is the engine running  [diceroll.fun](https://www.diceroll.fun).\n\n## Methods\n| **roll**( maxValue:```integer```, quantity:```integer```=1 ):```integer/array```       |\n| :---------------------------------------------------------------------------- |\n| Returns a random integer from 1 to the specified `maxValue`. If a `quantity` is supplied, an array of these random values will be provided with the same length as `quantity`|\n\n| **d4**(quantity:```integer```=1 ):```integer/array```       |\n| :---------------------------------------------------------------------------- |\n| Returns a random integer from **1 to 4**. If a `quantity` is supplied, an array of these random values will be provided with the same length as `quantity`|\n\n| **d6**(quantity:```integer```=1 ):```integer/array```       |\n| :---------------------------------------------------------------------------- |\n| Returns a random integer from **1 to 6**. If a `quantity` is supplied, an array of these random values will be provided with the same length as `quantity`|\n\n| **d8**(quantity:```integer```=1 ):```integer/array```       |\n| :---------------------------------------------------------------------------- |\n| Returns a random integer from **1 to 8**. If a `quantity` is supplied, an array of these random values will be provided with the same length as `quantity`|\n\n| **d10**(quantity:```integer```=1 ):```integer/array```       |\n| :---------------------------------------------------------------------------- |\n| Returns a random integer from **1 to 10**. If a `quantity` is supplied, an array of these random values will be provided with the same length as `quantity`|\n\n| **d12**(quantity:```integer```=1 ):```integer/array```       |\n| :---------------------------------------------------------------------------- |\n| Returns a random integer from **1 to 12**. If a `quantity` is supplied, an array of these random values will be provided with the same length as `quantity`|\n\n| **d20**(quantity:```integer```=1 ):```integer/array```       |\n| :---------------------------------------------------------------------------- |\n| Returns a random integer from **1 to 20**. If a `quantity` is supplied, an array of these random values will be provided with the same length as `quantity`|\n\n| **percentage**(quantity:```integer```=1 ):```integer/array```       |\n| :---------------------------------------------------------------------------- |\n| Returns a random integer from **1 to 100**. If a `quantity` is supplied, an array of these random values will be provided with the same length as `quantity`|\n\n| **advantage**():```object```       |\n| :---------------------------------------------------------------------------- |\n| Returns an object with two properties: `value` \u0026 `rolls`. `rolls` is an array of two random integers from **1 to 20** (d20). `value` is an integer equal to the higher of the two numbers in the `rolls` array.|\n\n| **disadvantage**():```object```       |\n| :---------------------------------------------------------------------------- |\n| Returns an object with two properties: `value` \u0026 `rolls`. `rolls` is an array of two random integers from **1 to 20** (d20). `value` is an integer equal to the lower of the two numbers in the `rolls` array.|\n\n## Usage\n```\nlet Dice = require('tabletop-dice')\n\n//Roll a d4\nDice.d4() //Example output: 3\n\n//Roll 4 d8's\nDice.d8(4)  //Example output: [2,6,3,8]\n\n//Roll at advantage\nDice.advantage() //Example output: { value: 14, rolls: [6, 14]}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fone20%2Ftabletop-dice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fone20%2Ftabletop-dice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fone20%2Ftabletop-dice/lists"}