Skip to main content

mitchallen.coin

PyPI version Python versions License Downloads CI codecov

A simple, lightweight Python package for coin flip simulations, perfect for 50/50 decisions, games, and probabilistic applications.

Installation

pip install mitchallen-coin

Or using uv:

uv add mitchallen-coin

Quick Start

from mitchallen.coin import flip, heads, tails

# Get a boolean coin flip result
result = flip()
print(result)  # True or False

# Alternative: using heads()
is_heads = heads()
print(is_heads)  # True or False

# Alternative: using tails()
is_tails = tails()
print(is_tails)  # True or False

Usage Examples

Simulate a Coin Flip

from mitchallen.coin import heads, tails

# Using heads()
if heads():
    print("Heads")
else:
    print("Tails")

# Or using tails()
if tails():
    print("Tails")
else:
    print("Heads")

Random 50/50 Decisions

from mitchallen.coin import flip

# Use flip() for 50/50 decisions
if flip():
    print("Event A happens")
else:
    print("Event B happens")

API Reference

flip()

Returns a random boolean value with 50% probability for True or False.

Returns:

  • bool: True or False with equal probability

Example:

from mitchallen.coin import flip

value = flip()
assert isinstance(value, bool)

# Use in conditional logic
if flip():
    print("Heads!")
else:
    print("Tails!")

heads()

Returns a random boolean value (same as flip()). Useful for simple boolean coin flip simulations.

Returns:

  • bool: True or False with equal probability

Example:

from mitchallen.coin import heads

result = heads()
if result:
    print("Heads!")
else:
    print("Tails!")

tails()

Returns a random boolean value (same as flip()). Useful for simple boolean coin flip simulations where you want to express the check as "tails".

Returns:

  • bool: True or False with equal probability

Example:

from mitchallen.coin import tails

result = tails()
if result:
    print("Tails!")
else:
    print("Heads!")

Why mitchallen.coin?

  • Simple: Clean API with intuitive functions
  • Lightweight: No dependencies
  • Type-safe: Full type annotations with mypy type checking
  • Quality: Enforced code quality with Ruff linting and formatting
  • Tested: Comprehensive test suite ensuring quality and reliability
  • Namespace package: Works alongside other mitchallen packages

Contributing

Contributions are welcome! See CONTRIBUTING.md for development setup and guidelines.

License

MIT License - see LICENSE for details.

Metadata

Release files for mitchallen-coin 1.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mitchallen-coin 1.0.15
File Size Uploaded Provenance
mitchallen_coin-1.0.15.tar.gz 32.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mitchallen-coin 1.0.15
File Interpreter ABI Platform
mitchallen_coin-1.0.15-py3-none-any.whl Python 3 none any Details

Total release size: 36.6 kB

Release files / mitchallen_coin-1.0.15.tar.gz

Download URL mitchallen_coin-1.0.15.tar.gz
Size 32.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5d428185ad0081d508bd6cf1e30525666fbb2cdafbcc47544281456e7af44526
BLAKE2b-256 checksum
How to use checksums
96fb4eb636f6ec3c22a3c9d29f11eeb8ab6eed622d4d7ec76121981b7bb2b89f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2025.

Transparency log

Release files / mitchallen_coin-1.0.15-py3-none-any.whl

Download URL mitchallen_coin-1.0.15-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a34cdb3d2d82aafb4ae51a226a5295e32c29263ac75230ab1ff262940fc99a0
BLAKE2b-256 checksum
How to use checksums
0d11a85fb95ee917a72df0825ba9596030f98b2691efc8b740ad1f7449e5e526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2025.

Transparency log

Security for mitchallen-coin 1.0.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mitchallen_coin-1.0.15.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page