math docs
    Preparing search index...

    Type Alias Isaac32

    State of an ISAAC-32 PRNG: two 256-word arrays plus three accumulators and a cursor into the current batch of results. Create one with create.

    ISAAC (Indirection, Shift, Accumulate, Add, Count) generates 256 words per round and hands them out one at a time; next/sample refill the batch automatically when it runs dry.

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

    type Isaac32 = {
        a: number;
        b: number;
        c: number;
        i: number;
        m: Uint32Array;
        r: Uint32Array;
    }
    Index
    a b c i m r
    a: number

    accumulator

    b: number

    previous result

    c: number

    counter, incremented once per batch

    i: number

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

    m: Uint32Array

    internal state ("mem"), 256 words

    r: Uint32Array

    current batch of results, 256 words