Implement ArrayUtil::arrayRandomIndex()

This commit is contained in:
Zach Borboa
2022-09-28 12:15:03 -07:00
parent 7ce0fc5ced
commit 067cb72854
2 changed files with 15 additions and 2 deletions
+14 -1
View File
@@ -136,7 +136,20 @@ class ArrayUtil
*/
public static function arrayRandom($array)
{
return $array[mt_rand(0, count($array) - 1)];
return $array[static::arrayRandomIndex($array)];
}
/**
* Array Random Index
*
* @access public
* @param $array
*
* @return integer
*/
public static function arrayRandomIndex($array)
{
return mt_rand(0, count($array) - 1);
}
/**