Skip to content

Kirby 4.5.0

A::random()

Returns a number of random elements from an array, either in original or shuffled order

A::random(array $array, int $count = 1, bool $shuffle = false): array

Parameters

Name Type Default
$array * array
$count int 1
$shuffle bool false

Return type

array

Exceptions

Type Description
Exception When $count is larger than array length

Parent class

Kirby\Toolkit\A