{"id":16671101,"url":"https://github.com/lurst/dragn","last_synced_at":"2025-08-02T00:07:49.503Z","repository":{"id":7365197,"uuid":"8690749","full_name":"LuRsT/dragn","owner":"LuRsT","description":":game_die: Using dice in a Pythonic way","archived":false,"fork":false,"pushed_at":"2025-03-08T16:04:07.000Z","size":326,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T03:22:27.474Z","etag":null,"topics":["dice","hacktoberfest","python","random"],"latest_commit_sha":null,"homepage":"","language":"Python","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/LuRsT.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":"2013-03-10T20:07:00.000Z","updated_at":"2025-03-08T16:04:07.000Z","dependencies_parsed_at":"2024-10-12T11:40:59.979Z","dependency_job_id":"d0264298-b558-44ed-8a86-9fa6a35c9625","html_url":"https://github.com/LuRsT/dragn","commit_stats":{"total_commits":61,"total_committers":4,"mean_commits":15.25,"dds":0.08196721311475408,"last_synced_commit":"9c310264980646f7aab9260c9282102406789c7e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuRsT%2Fdragn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuRsT%2Fdragn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuRsT%2Fdragn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuRsT%2Fdragn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuRsT","download_url":"https://codeload.github.com/LuRsT/dragn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244838756,"owners_count":20518878,"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","hacktoberfest","python","random"],"created_at":"2024-10-12T11:40:56.010Z","updated_at":"2025-03-21T17:32:53.300Z","avatar_url":"https://github.com/LuRsT.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/lurst/dragn/master/dragn_logo.png\" alt=\"Dragn Logo\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://pypi.org/project/dragn/\"\u003e\u003cimg alt=\"Supported Python versions\" src=\"https://img.shields.io/pypi/pyversions/dragn.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/dragn/\"\u003e\u003cimg alt=\"PyPI version\" src=\"https://img.shields.io/pypi/v/dragn.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://travis-ci.org/LuRsT/dragn\"\u003e\u003cimg alt=\"Build Status\" src=\"https://travis-ci.org/LuRsT/dragn.svg?branch=master\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/LuRsT/dragn\"\u003e\u003cimg alt=\"Codecoverage\" src=\"https://codecov.io/gh/LuRsT/dragn/branch/master/graph/badge.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg alt=\"Licence\" src=\"https://img.shields.io/github/license/LuRsT/dragn.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/ambv/black\"\u003e\u003cimg alt=\"Code style: Black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pepy.tech/badge/dragn\"\u003e\u003cimg alt=\"Downloads\" src=\"https://img.shields.io/pypi/dm/dragn.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n___\n\n\u003cp align=\"center\"\u003e\n    \u003cem\u003eRoll dice in your python programs\u003c/em\u003e\n\u003c/p\u003e\n\n___\n\n### Why?\n\nI wanted a better API to rolling dice using Python, and the usual `random.randint` is very good,\nbut doesn't really represent rolling dice quite the way I imagine it.\n\nThis was a good learning experiment, but I'm not expecting anyone to use it.\n\n\n### Who is this for?\n\nPeople building RPGs, or games that would involve dice and who care about how their code looks\nlike.\n\nI may be biased, but I really believe that this library provides a much better interface than\npure `random.randint`.\n\n\n### How to install\n\n```shell\n$ pip install dragn\n```\n\n\n### How to use\n\n```python\n\u003e\u003e from dragn.dice import D4, D6, D8, D10\n\u003e\u003e\u003e D6()\n1\n\u003e\u003e\u003e f\"You roll the die and the result is {D8()}\"\n'You roll the die and the result is 4'\n\u003e\u003e\u003e f\"You roll 3 dice and you get {[D8() for _ in range(3)]}\"\n\u003e\u003e\u003e 'You roll 3 dice and you get [3, 1, 8]'\n\u003e\u003e\u003e four_dice = D4 * 4\n\u003e\u003e\u003e f\"You roll 4 dice and the results are {four_dice()}\"\n'You roll 4 dice and the results are (4, 3, 1, 2)'\n\u003e\u003e\u003e f\"You roll two dice and the results are {two_dice()}\"\n'You roll two dice and the results are (3, 4)'\n\u003e\u003e\u003e dice_tower = (D6 * 2) + D4\n\u003e\u003e\u003e f\"You roll two D6 and a D4 and check the results {dice_tower()}\"\n'You roll two D6 and a D4 and check the results (2, 2, 6)'\n\u003e\u003e\u003e five_dice = D10 * 5\n\u003e\u003e\u003e result = five_dice()\n\u003e\u003e\u003e result\n(7, 10, 2, 8, 1)\n\u003e\u003e\u003e f\"The lowest value dice in the pool was: {min(result)}\"\n'The lowest value dice in the pool  was: 1'\n\u003e\u003e\u003e f\"The highest value dice in the pool  was: {min(result)}\"\n'The highest value dice in the pool  was: 10'\n```\n\nFor more examples, check the [tests](https://github.com/LuRsT/dragn/blob/master/dragn/tests/test_dice.py)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flurst%2Fdragn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flurst%2Fdragn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flurst%2Fdragn/lists"}