wr (Weighted Random)
wr is a weighted random implementation in Python.
wr.choice can be fed with a mapping (such as dictionaries) containing a returnable (what to return) and a integer representing their respective weight. The key can be anything hashable but the weight must be a integer.
Optionally you may feed wr.choice with a sequence of pairs.
Documentation
Documentation is available at http://wr.readthedocs.org/
Example
>>> import wr
>>> data = {'cat': 60, 'dog': 30, 'bird': 10}
>>> animal = wr.choice(data)
>>> print animal
cat # well, the cat had a good 60% shot at it.
Installation
Install wr with pip install wr or just download wr.py and place it in your project directory.
License
Metadata
Release files for wr 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| wr-0.2.1.tar.gz | 2.6 kB | Without provenance | Details |
Release files / wr-0.2.1.tar.gz
| Download URL | wr-0.2.1.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bcc54c1feda299daa0b8cec77d2457892b13a0a7962bedc1d08a494d1d85542
|
|
BLAKE2b-256 checksum How to use checksums |
ec7176fb64c483efee9ac4d23f7c92dbe42551cbacb4fa76881194a047b08b51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for wr 0.2.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.