Skip to content

Commit 9feabad

Browse files
committed
docs: add Advanced Features section to README
1 parent b4b6290 commit 9feabad

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,66 @@ for _ in range(1000):
7575
trueentropy.stop_collector()
7676
```
7777

78+
## Advanced Features
79+
80+
### Async Support
81+
82+
```python
83+
import asyncio
84+
from trueentropy import aio
85+
86+
async def main():
87+
value = await aio.random()
88+
uuid = await aio.random_uuid()
89+
password = await aio.random_password(16)
90+
91+
asyncio.run(main())
92+
```
93+
94+
### Pool Persistence
95+
96+
Save and restore entropy pool state between runs:
97+
98+
```python
99+
from trueentropy import get_pool
100+
from trueentropy.persistence import save_pool, load_pool
101+
102+
# Save current pool state
103+
save_pool(get_pool(), "entropy_state.bin")
104+
105+
# Later: restore the pool
106+
pool = load_pool("entropy_state.bin")
107+
```
108+
109+
### Multiple Pools
110+
111+
Isolated entropy pools for different purposes:
112+
113+
```python
114+
from trueentropy.pools import PoolManager
115+
116+
manager = PoolManager()
117+
manager.create("crypto") # For security-critical operations
118+
manager.create("gaming") # For game mechanics
119+
120+
secure_bytes = manager.randbytes("crypto", 32)
121+
dice_roll = manager.randint("gaming", 1, 6)
122+
```
123+
124+
### Cython Acceleration
125+
126+
Optional C-level performance (10-50x faster for some operations):
127+
128+
```bash
129+
pip install -e ".[cython]"
130+
python setup.py build_ext --inplace
131+
```
132+
133+
```python
134+
from trueentropy.accel import is_accelerated
135+
print(is_accelerated()) # True if compiled
136+
```
137+
78138
## Entropy Sources
79139

80140
### Timing Jitter

0 commit comments

Comments
 (0)