Skip to content

random

random(array)

Returns a random element from array, or undefined if the array is empty.

ts
random([1, 2, 3, 4]); // 2 (random)
ts
pipe([1, 2, 3, 4], random()); // 2 (random)