Options
All
  • Public
  • Public/Protected
  • All
Menu

Module sample

Index

References

Functions Array

References

Renames and re-exports sample

Array Functions

  • sample<T>(array: T[]): T
  • Gets a random element from array.

    NOT support object

    since

    5.7.0

    example
    sample([1, 2, 3, 4])
    // => 2

    Type Parameters

    • T

    Parameters

    • array: T[]

      The array to sample.

    Returns T

    Returns the random element.