Get one or more random keys from an array

array:get_random_keys(ARRAY $array, INT $number_of_keys=1)

$array = ['foo', 'hello world', 'last value']
array:get_random_keys($array)
#=> 2

#===
$array = ['foo', 'hello world', 'last value']
$array[array:get_random_keys($array)]
#=> "foo"

#===
$array = ['foo', 'hello world', 'last value']
array:get_random_keys($array, 2)
#=> [
#=>     0,
#=>     2
#=> ]

Copyright ©2013-2022 SunSed®. All rights reserved.