Skip to main content

CommonRandomItemFromList

Callable

  • CommonRandomItemFromList<T>(ItemPrevious: T, ItemList: readonly T[]): T

  • Get a random item from a list while making sure not to pick the previous one. Function expects unique values in the list. If there are multiple instances of ItemPrevious, it may still return it.


    Type parameters

    • T

    Parameters

    • ItemPrevious: T

      Previously selected item from the given list

    • ItemList: readonly T[]

      List for which to pick a random item from

    Returns T

    • The randomly selected item from the list