Skip to content
Chung Leong edited this page Jan 10, 2022 · 3 revisions

array_rand - Pick one or more random entries out of an array

uint32 array_rand( array $array )

uint32[num] array_rand( array $array, uint32 $num_req )

array_rand() picks one or more random entries out of an array, and returns the key (or keys) of the random entries.

Parameters:

array - The input array.

num_req - The number of entries to pick.

Return Value:

An array containing keys to the random entries. It is a scalar if num_req is omitted or is the constant 1.

Version

1.0 and above.

Clone this wiki locally