Class RandomSelector<Type>

A class for randomly selecting elements from a given list. This class assumes an equal distribution for all elements of the list.

Type Parameters

  • Type

Constructors

Accessors

  • get size(): number
  • Get the number of elements in the list.

    Returns number

Methods

  • Selects random element from the list.
    This method assumes an equal distribution for all elements of the list.
    If the list is empty, the function will return undefined.

    Returns undefined | Type

  • Selects random element from the list, then removes that element from the list.
    This method assumes an equal distribution for all elements of the list.
    If the list is empty, the function will return undefined.

    Returns undefined | Type