clock-rand is organized into several modules:
fast/- Fast deterministic RNGscrypto/- Cryptographically secure RNGscustom/- Custom blockchain-aware RNGsdistributions/- Distribution traits and implementationsutils/- Utility functions
- no_std first: Core functionality works without std
- Feature flags: Enable only what you need
- Trait-based: Compatible with rand ecosystem
- Security first: Clear separation between fast and crypto RNGs
- Blockchain-aware: Native support for blockchain state
- Xoshiro256+: Fast, high-quality, 256-bit state
- PCG64: Excellent statistical properties, small footprint
- SplitMix64: Ultra-fast seeding algorithm
- Blake3Drbg: Fast crypto RNG using Blake3
- ChaCha20Rng: ChaCha20-based crypto RNG
- AesCtrRng: FIPS-compliant AES-CTR DRBG
- ChainSeed-X: Hybrid Blake3+PCG with fork detection
- EntroCrypt: Hybrid ChaCha20+Blake3 for maximum security
- HashMix256: Custom hash-based RNG
ChainSeed-X implements fork detection by:
- Tracking recent block hashes
- Comparing new block hash with expected
- Automatically reseeding on divergence
- Maintaining deterministic state
Thread-safe wrappers use:
Arc<Mutex<T>>for exclusive accessArc<RwLock<T>>for read-write access- Thread-local storage for global RNG
State serialization supports:
- Checkpointing for deterministic replay
- Versioned state format
- Cross-platform compatibility