Skip to content

Commit 09f4d2d

Browse files
authored
Merge pull request #41 from bbc2/improve-readme
Improve readme
2 parents f95462c + b73390c commit 09f4d2d

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
# Shuffled: Random iterators for large integer ranges
22

3-
## Usage
4-
53
Shuffled is a library for iterating randomly and without repetition over integer ranges.
64
It doesn’t store all the integers in memory so that you can work with ranges of up to
75
2<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
2740
10.79.219.74
2841
10.166.105.25
2942
10.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

Comments
 (0)