fbsim-core JavaScript & TypeScript API - v1.0.0-beta.2
    Preparing search index...

    Class Rng

    A WASM-compatible random number generator.

    This wrapper uses SmallRng internally, which is suitable for game simulations where cryptographic security is not required.

    Index

    Constructors

    • Creates a new RNG with a random seed.

      Entropy is obtained from the JavaScript runtime via crypto.getRandomValues().

      Returns Rng

    Methods

    • Returns void

    • Generates a random float between 0.0 and 1.0.

      Returns number

    • Generates a random 32-bit unsigned integer.

      Returns number

    • Generates a random 64-bit unsigned integer.

      Returns bigint

    • Creates a new RNG with a specific seed for reproducible simulations.

      Use this when you need deterministic results, such as for testing or replay functionality.

      Parameters

      • seed: bigint

      Returns Rng