BC-LifeHash-CLI TypeScript Library - v1.0.0-alpha.20
    Preparing search index...

    Function randomElement

    • Selects a random element from an array.

      Port of random_element() template from lifehash.cpp lines 38-50.

      Type Parameters

      • T

      Parameters

      • array: T[]

        The array to select from

      Returns T

      A random element from the array

      randomElement(["A", "B", "C"]) // => "A" or "B" or "C"