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>> 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.2.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for randy-0.9.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 296419be9e55d2f28d69e1c774cd771ada4fe9ef18cc9a9f2ad6dd6fe60e565c |
|
MD5 | 38795f15666a9509c45e67ce80476e44 |
|
BLAKE2b-256 | f04bc85ad5f1aefce5ecbf8ca8ecbb365cc0e2812b280c17d4607fdd9c3634cc |