Skip to content

cryptoRandom

const cryptoRandom: CryptoEngine

Defined in: src/engine/crypto.ts:71

The platform CSPRNG, wrapped as an engine.

crypto.getRandomValues in browsers, workers and edge runtimes; node:crypto on Node. Unpredictable, and for that reason not seedable — which is what backs ransu/secure and the identifier functions.

cryptoRandom.nextUint32(); // unpredictable
cryptoRandom.seedable; // false
new Random(cryptoRandom).pick(["a", "b", "c"]);