Skip to content

CryptoEngine

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

The platform CSPRNG behind the engine interface. The singleton cryptoRandom is the only instance you need.

cryptoRandom instanceof CryptoEngine; // true

new CryptoEngine(): CryptoEngine

CryptoEngine

readonly algorithm: "crypto" = "crypto"

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

Identifies the algorithm in EngineState.

Engine.algorithm


readonly seedable: false = false

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

Whether the engine can be re-seeded. Math.random and the CSPRNG cannot.

Engine.seedable

clone(): Engine

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

Engine

Engine.clone


fillBytes(out): void

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

Uint8Array

void

Engine.fillBytes


fillUint32(out): void

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

Uint32Array

void

Engine.fillUint32


nextFloat64(): number

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

A uniform double in [0, 1) with 53 bits of precision.

number

Engine.nextFloat64


nextUint32(): number

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

A uniform integer in [0, 2^32).

number

Engine.nextUint32