math docs
    Preparing search index...

    Type Alias Isaac64

    State of an ISAAC64 PRNG. Create one with create.

    ISAAC64 is the 64-bit variant of ISAAC (Indirection, Shift, Accumulate, Add, Count): same design as Isaac32 but on 64-bit words, giving a larger state and 64-bit output. JavaScript has no native 64-bit integers, so each 64-bit word is split into two 32-bit lanes — *Hi (bits 63..32) and *Lo (bits 31..0) — and the hot loop does 64-bit math with explicit carries in plain numbers. That keeps the whole generator in fast Word32 arithmetic (see the note on Isaac32's typed arrays); a bigint implementation is ~6x slower. next reassembles a bigint; sample skips bigint entirely.

    The state is a plain object, so it can be inspected, cloned (to fork a sequence), or serialised. The lanes are typed arrays, so a structural clone (e.g. structuredClone) forks correctly; a shallow {...} copy shares them.

    type Isaac64 = {
        aHi: number;
        aLo: number;
        bHi: number;
        bLo: number;
        cHi: number;
        cLo: number;
        i: number;
        mHi: Uint32Array;
        mLo: Uint32Array;
        rHi: Uint32Array;
        rLo: Uint32Array;
    }
    Index
    aHi: number

    accumulator

    aLo: number
    bHi: number

    previous result

    bLo: number
    cHi: number

    counter, incremented once per batch

    cLo: number
    i: number

    cursor into r; a value of 256 means the batch is spent

    mHi: Uint32Array

    internal state ("mem") high/low lanes, 256 words

    mLo: Uint32Array
    rHi: Uint32Array

    current batch of results, high/low lanes, 256 words

    rLo: Uint32Array