Skip to main content

A dice rolling random number generator

Project description

mitchallen-roll

A simple dice rolling random number generator for Python.

Installation

pip install mitchallen-roll

Or with uv:

uv add mitchallen-roll

Usage

from mitchallen.roll import roll, d6, d20

# Roll a standard 6-sided die
result = roll()  # Returns 1-6

# Roll a custom die
result = roll(20)  # Returns 1-20

# Convenience functions
result = d6()   # Roll a 6-sided die
result = d20()  # Roll a 20-sided die

API Reference

roll(sides=6) -> int

Roll a die with the specified number of sides.

Parameters:

  • sides (int): Number of sides on the die (default: 6, minimum: 1)

Returns:

  • int: A random integer from 1 to sides (inclusive)

Raises:

  • ValueError: If sides is less than 1

d6() -> int

Convenience function to roll a 6-sided die.

Returns:

  • int: A random integer from 1 to 6

d20() -> int

Convenience function to roll a 20-sided die.

Returns:

  • int: A random integer from 1 to 20

Development

See the main repository README for development setup instructions.

License

MIT License - see LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mitchallen_roll-1.0.1.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mitchallen_roll-1.0.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file mitchallen_roll-1.0.1.tar.gz.

File metadata

  • Download URL: mitchallen_roll-1.0.1.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for mitchallen_roll-1.0.1.tar.gz
Algorithm Hash digest
SHA256 26ada94effbc7dab5d64d0d6484db075460469afbd1f003c8f48120379dc27bf
MD5 ada1def4ec7f2f9fd728ffe90012da3a
BLAKE2b-256 714366a0d5b1c708d25c780f0077747abbd1939f46d91c3d3436a732ae346220

See more details on using hashes here.

File details

Details for the file mitchallen_roll-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mitchallen_roll-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e22af955c9e349b6b858a3af23575465d373ffc0a0b68526df6f16c5c9656965
MD5 0eff32b4b90759a25cbbdc7d529b7fae
BLAKE2b-256 e294643efedcc9671908e85d1c3825a664f79c2f2bb44d7ea919b9f5a71bba0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page