Skip to main content

A dice rolling random number generator

Project description

mitchallen-roll

PyPI version Python versions License Downloads CI codecov

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.9.tar.gz (24.3 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.9-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mitchallen_roll-1.0.9.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mitchallen_roll-1.0.9.tar.gz
Algorithm Hash digest
SHA256 8a32ed7e355c16480921670f05fc028425dbf70d07b3537d8af00d880b3b7c2f
MD5 596a28d514a0452d9710e139e89d6ad1
BLAKE2b-256 c9b5e86d366be43a00b73ee1b23278f2cea8307845fa4b9be350f36e0c69e69f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mitchallen_roll-1.0.9.tar.gz:

Publisher: publish-roll.yml on mitchallen/python-coin-flip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for mitchallen_roll-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3f4bf005aa6c2b44ee29e5e8422d2af43a3ffc09177285ce5ed4c753a4122e3f
MD5 f84785adcb3823df68da9b1504e47ed1
BLAKE2b-256 f374dbb422c7d6d0c49eee2b4e7102c9708eeb7b9a93b09c206a4590bd1171ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for mitchallen_roll-1.0.9-py3-none-any.whl:

Publisher: publish-roll.yml on mitchallen/python-coin-flip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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