@wow_1/hyperflux
v1.0.3
Published
Ultra-fast, crypto-hardened dual-mode RNG for Node.js and web. (fast & secure modes unified)
Maintainers
Readme
HyperFlux
Ultra-fast, crypto-hardened dual-mode RNG for Node.js and the Web.
Two modes — fast and secure — unified in one clean API.
Installation
npm install @wow_1/hyperfluxUsage
import HyperFlux from "hyperflux";
const fast = new HyperFlux("fast");
console.log(fast.random()); // 0~1 float
console.log(fast.randInt(10)); // integer 0~10
console.log(fast.shuffle([1,2,3,4]));
const secure = new HyperFlux("secure");
console.log(secure.random()); // cryptographically hardenedAPI
| Method | Description |
| --------------------- | ---------------------- |
| random() | Returns float in [0,1] |
| randInt(max) | Integer in [0, max] |
| randRange(min, max) | Float in range |
| shuffle(array) | Returns shuffled copy |
| reseed(seed?) | Reseed RNG |
Modes
| Mode | Description |
| ---------- | ----------------------------------------------------------------- |
| "fast" | Xoshiro-based, CPU-optimized RNG (very fast, non-crypto) |
| "secure" | Crypto-seeded, buffer-based RNG (high entropy, harder to predict) |
Testing
npm testLicense
MIT © asdf
