A pure-python random number generator expander
Project description
A pure-python random number generator expander.
Given a random number generator that yields numbers in the range 1-n, create a new random number generator that yields numbers in the range 1-y where y>x, x>1, y>1, y>x**2
How do I get set up?
python setup.py install
Dependencies: six
Dependencies (test): Coverage, nose
How to run tests: ./runtests.sh
Deployment instructions: pip install shifty
Contribution guidelines
I accept pull requests.
What about test coverage?
There is a full suite of unit-tests.
Who do I talk to?
Francis Horsman: francis.horsman@gmail.com
Example
>>> from randy import randy >>> import random >>> r = randy(5, 7, fn=lambda: random.randint(1, 5)) Slice it: >>> random_value = r[2] 3 Call it: >>> random_value = r() 1 Iterate with it: >>> random_value = iter(r).next() 5 Print it: >>> str(r) 'randy(7 from 5): [[1, 2, 3, 4, 5], [6, 7, 1, 2,3], [4, 5, 6, 7, 1], [2, 3, 4, 5, 6], [7, 0, 0, 0, 0]]'
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
randy-0.9.3.tar.gz
(5.4 kB
view details)
Built Distribution
File details
Details for the file randy-0.9.3.tar.gz
.
File metadata
- Download URL: randy-0.9.3.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b4107a8c1df8fc1b1635f506f9fe2d2fc1dd91ae0c419179f0a0cc1c26f8805 |
|
MD5 | 4deeb8df6b0e911c406965a45253b398 |
|
BLAKE2b-256 | 76f62fd6fbab3c7d9654ee791cbc447dffc1f3b2c5a4143267b53480eac054cb |
File details
Details for the file randy-0.9.3-py2.py3-none-any.whl
.
File metadata
- Download URL: randy-0.9.3-py2.py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aaadadd2a583ec2c3cec8e70605603e12e34bd1ade18e7c4919e9fcb3d2011aa |
|
MD5 | 57c74ddd1dca33b1a4db40e8da14eaed |
|
BLAKE2b-256 | 08d6f63517a737ac8357fa769a346c6a5e7aa04a0129edd28051d9329d8f17ee |