Class RandomGenerator

A PRNG seeded random number generator

Implements

  • IterableIterator<number>

Constructors

Properties

Methods

Constructors

Properties

rand: (() => number)

Methods

  • Generate a random number in for loops (infinitely)

    Returns IterableIterator<number>

    the next random number

  • Get the next random number.

    Returns IteratorResult<number, number>

    the next random number.

  • Get a random element from an array of possible elements based on weight.

    Type Parameters

    • T

    Parameters

    • possibleElements: WeightedArray<T>

      A weighted array of elements to select randomly from.

    Returns T

    A random element from the weighted array.