Skip to main content

Function: pickRandom()

pickRandom(array, amount)

pickRandom<T>(array: readonly T[], amount?: 1): T

Picks a random element from an array

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
arrayreadonly T[]The array to pick a random element from
amount?1Amount of values to obtain randomly (default: 1)

Returns

T

Defined in

pickRandom.ts:6

pickRandom(array, amount)

pickRandom<T>(array: readonly T[], amount: number): T[]

Type Parameters

Type Parameter
T

Parameters

ParameterType
arrayreadonly T[]
amountnumber

Returns

T[]

Defined in

pickRandom.ts:7