Skip to main content

Function: pickRandom()

Call Signature​

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

Defined in: pickRandom.ts:6

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

Call Signature​

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

Defined in: pickRandom.ts:7

Picks a random element from an array

Type Parameters​

Type Parameter
T

Parameters​

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

Returns​

T[]