Skip to content

Commit 64ade4d

Browse files
committed
Update README
1 parent 5093537 commit 64ade4d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ So far it's only tested on Python 3.8 and Python 3.9
1919

2020
Basic usage:
2121

22-
```
22+
```python
2323
from optimus_ids import Optimus
2424
my_optimus = Optimus(
2525
prime=<your prime number>
@@ -31,7 +31,7 @@ assert my_int_id == my_optimus.decode(my_int_id_hashed)
3131

3232
The caveat with the usage above is that every time you create your `Optimus` instance it will have a random component, even with using the same prime, so a proper usage should be like this:
3333

34-
```
34+
```python
3535
from optimus_ids import Optimus
3636
my_optimus = Optimus(
3737
prime=<your prime number>,
@@ -41,17 +41,18 @@ my_int_id = <some id you have>
4141
my_int_id_hashed = my_optimus.encode(my_int_id)
4242
assert my_int_id == my_optimus.decode(my_int_id_hashed)
4343

44-
To generate a random number you could do this:
4544
```
4645

47-
```
46+
To generate a suitable random number you could do this:
47+
48+
```python
4849
from optimus_ids import rand_n, MAX_64_INT # use 32 instead of 64 if you want to
4950
my_random_number = rand_n(MAX_64_INT - 1)
5051
```
5152

52-
You can also generate an `Optimus` intance and then keep its `prime`, `inverese` and `random` properties stored, so you can always configure a new instance with the same components, or even pickle it:
53+
You can also generate an `Optimus` intance and then keep its `prime`, `inverse` and `random` properties stored, so you can always configure a new instance with the same components, or even pickle it:
5354

54-
```
55+
```python
5556
from optimus_ids import generate, Optimus
5657
my_optimus = generate()
5758

@@ -84,6 +85,8 @@ assert my_optimus.decode(my_other_optimus.encode(42)) == my_other_optimus.decode
8485
   └── p50.txt
8586
```
8687

88+
Check the [tests](tests/) folder for test cases and other usage examples.
89+
8790
## License
8891

8992
This work is licensed under

0 commit comments

Comments
 (0)