Democritus functions for working with random.
Project description
Democritus Random
Democritus functions[1] for working with random.
[1] Democritus functions are simple, effective, modular, well-tested, and well-documented Python functions.
We use d8s
(pronounced "dee-eights") as an abbreviation for democritus
(you can read more about this here).
Installation
pip install d8s-random
Usage
You import the library like:
from d8s_random import *
Once imported, you can use any of the functions listed below.
Functions
-
def random_number(): """Return a random number in range [0.0, 1.0)."""
-
def random_integer(a=0, b=10): """Return a random number between a and b (inclusive)."""
-
def random_xkcd_integer(): """Get a random number using the method described here: https://xkcd.com/221/."""
-
def random_dilbert_integer(): """Get a random number using the method described here: https://dilbert.com/strip/2001-10-25c."""
-
def random_shuffle(iterable): """Shuffle the order of the given iterable."""
-
def random_choice(iterable): """Return a random item from the iterable."""
-
def random_choices(iterable, n: int): """Return a random item from the iterable."""
-
def random_sample(iterable, n): """Return n items, selected at random, from the iterable."""
Development
👋 If you want to get involved in this project, we have some short, helpful guides below:
If you have any questions or there is anything we did not cover, please raise an issue and we'll be happy to help.
Credits
This package was created with Cookiecutter and Floyd Hightower's Python project template.
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
Built Distribution
File details
Details for the file d8s_random-0.6.0.tar.gz
.
File metadata
- Download URL: d8s_random-0.6.0.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f58f98d2eac46880bd40017f43a5fd95c199445e081f4e39403519d44677fcb1 |
|
MD5 | c740a8716c45f8d50b090d9c9f5903b7 |
|
BLAKE2b-256 | 5d559dd609d45341901134aebe368123eeaabb7e7a00c3e3a9156a9b90c7f97d |
File details
Details for the file d8s_random-0.6.0-py2.py3-none-any.whl
.
File metadata
- Download URL: d8s_random-0.6.0-py2.py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9518d561c5aed1e0f2159cd753dbfef2f6c613e01fe75de5b83bf8302c7fbbf2 |
|
MD5 | 843e430edee196d4bac76d0c688e70c7 |
|
BLAKE2b-256 | 57e8d44828c37611e283e1807c6219ffa103db9470076989e5bb5851200bebd0 |