11# Shuffled: Random iterators for large integer ranges
22
3- ## Usage
4-
53Shuffled is a library for iterating randomly and without repetition over integer ranges.
64It doesn’t store all the integers in memory so that you can work with ranges of up to
752<sup >128</sup > elements, even with your standard RAM available.
86
7+ ## Installation
8+
9+ ``` shell
10+ pip install shuffled
11+ ```
12+
13+ ## Usage
14+
15+ Example: Generating a permutation of integers.
16+
917``` python
18+ >> > from shuffled import Shuffled
1019>> > shuffled_range = Shuffled(10 )
1120>> > list (shuffled_range)
1221[4 , 1 , 2 , 9 , 8 , 5 , 3 , 0 , 6 , 7 ]
@@ -15,7 +24,11 @@ It doesn’t store all the integers in memory so that you can work with ranges o
1524[4 , 1 , 2 , 9 , 8 , 5 , 3 , 0 , 6 , 7 ]
1625```
1726
27+ Example: Listing all IP addresses in a subnet in random order.
28+
1829``` python
30+ >> > import ipaddress
31+ >> > from shuffled import Shuffled
1932>> > network = ipaddress.IPv4Network(' 10.0.0.0/8' )
2033>> > shuffled_range = Shuffled(network.num_addresses)
2134>> > for index in shuffled_range:
@@ -27,12 +40,15 @@ It doesn’t store all the integers in memory so that you can work with ranges o
274010.79 .219.74
284110.166 .105.25
294210.19 .5.91
30- [ ... ]
43+ # Continues for all 16M addresses in the subnet
3144```
3245
3346## Release
3447
35- - Update the [ changelog] ( CHANGELOG.md ) .
36- - Bump the version identified in [ ` pyproject.toml ` ] ( pyproject.toml ) .
48+ - Update the [ changelog] .
49+ - Bump the version identified in [ ` pyproject.toml ` ] .
3750- After those changes are merged into ` main ` , tag the commit on ` main ` and push it.
3851 - The CI/CD process will publish the new package version on PyPI.
52+
53+ [ changelog ] : CHANGELOG.md
54+ [ `pyproject.toml` ] : pyproject.toml
0 commit comments