Skip to content

Function: array_rand() ​

array_rand<T>(array, num?): T | T[] | undefined

Defined in: src/php-arrays.ts:229

Pick one or more random entries out of an array.

Type Parameters ​

T ​

T

Parameters ​

array ​

T[]

The source array

num? ​

number = 1

The number of entries to pick

Returns ​

T | T[] | undefined

The random entry or entries

Documentation of 1.0.13 , built from cf61d3b on 1.0.13 by pipeline #2985011498 on 2026-10-21.