Skip to content

Function: pickRandom() ​

ts
function pickRandom<T>(...args: T[]): T;

Pick one of parameters.

Not @inline: the rest parameter is consumed as a whole array ($fromArray(args), args.length), not a ...args spread, so the inline plugin cannot substitute it.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterTypeDescription
...argsT[]List of arguments to pick from.

Returns ​

T

One of args based on random choice.