Taos API Reference
    Preparing search index...

    Class Random

    Seeded pseudo-random number generator using the Xorwow variant of Marsaglia's xorshift family.

    Backed by a Uint32Array of 6 state words (4 xorshift lanes + a Weyl counter + last output), so the instance is itself the state buffer.

    Hierarchy

    Indexable

    • [index: number]: number
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    global: Random = ...

    Process-wide shared instance, seeded from Date.now() at module load.

    Accessors

    • get seed(): number

      Returns the current head state word (does not return the originally-supplied seed).

      Returns number

    • set seed(seed: number): void

      Re-seeds the generator and resets all internal state from seed.

      Parameters

      • seed: number

      Returns void

    Methods

    • Restores the generator to the state right after construction (replays the same sequence).

      Returns void

    • Returns a uniform random integer in [0, 0xFFFFFFFF].

      Returns number

    • Returns a single-precision float in [0, 1], or in [min, max] when min is provided.

      Parameters

      • Optionalmin: number

        lower bound (inclusive)

      • Optionalmax: number

        upper bound (inclusive); defaults to 1 when min is provided

      Returns number

    • Returns a double in [0, 1) with full 53-bit mantissa resolution, or in [min, max] when min is provided.

      Parameters

      • Optionalmin: number

        lower bound (inclusive)

      • Optionalmax: number

        upper bound (inclusive); defaults to 1 when min is provided

      Returns number