Skip to main content

Iterate randomly over large integer ranges

Project description

Shuffled is a library for iterating randomly and without repetition over integer ranges. It doesn’t store all the integers in memory so that you can work with ranges of up to 2128 elements, even with your standard RAM available.

>>> shuffled_range = Shuffled(10)
>>> list(shuffled_range)
[4, 1, 2, 9, 8, 5, 3, 0, 6, 7]
>>> same_shuffled_range = Shuffled(10, seed=shuffled_range.seed)
>>> list(same_shuffled_range)
[4, 1, 2, 9, 8, 5, 3, 0, 6, 7]
>>> network = ipaddress.IPv4Network('')
>>> shuffled_range = Shuffled(network.num_addresses)
>>> for index in shuffled_range:
...     print(network[index])

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 shuffled, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size shuffled-0.2-py3-none-any.whl (5.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size (10.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page