Skip to main content

Random generator helper for Python

Project description


Code style: black Actions Status License: MIT pypi

ChancePy - Random generator helper for Python. Inspired by ChanceJS.


with pip

pip install chancepy

with poetry

poetry add chancepy


from chancepy import Chance

# Basic Methods
rand_string = Chance.string()
rand_guid = Chance.guid()
rand_int =, max=32)
rand_letter = Chance.letter(casing='lower')
rand_char = Chance.character(pool='acegikmoqsuwy')

# Utilities
rand_choice = Chance.pickone([1, 2, 3])
rand_2_choices = Chance.pickset(['a', 'b', 'c', 'd'], 2)

# Time
rand_date_in_april =
rand_year = Chance.year(mini=1990)
rand_month_name = Chance.month(mode="full")
rand_weekday = Chance.weekday(mode="short")
rand_hour = Chance.hour()
rand_min = Chance.minute()
rand_second = Chance.second()
rand_millisecond = Chance.millisecond()
rand_timezone = Chance.timezone()
rand_timestamp = Chance.timestamp()


PRs are welcome!

Project details

Download files

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

Files for chancepy, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size chancepy-0.1.2.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View
Filename, size chancepy-0.1.2-py3-none-any.whl (5.1 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page