random() public method

Picks a random element from the array
public random ( array $array ) : mixed
$array array
return mixed A random entry or NULL if the array is empty
 /**
  * @test
  * @dataProvider randomExamples
  */
 public function randomWorks($array, $expected)
 {
     $helper = new ArrayHelper();
     $result = $helper->random($array);
     $this->assertEquals($expected, in_array($result, $array));
 }