src/DataListTrait.php
public function getRandom()
    {
        $this->internalDataListUpdate();
        $count = sizeof($this->internalDataListData);
        if ($count > 0) {
            $index = rand(0, $count - 1);
            if (isset($this->internalDataListData[$index])) {
                return $this->internalDataListUpdateValueIfNeeded($this->internalDataListData, $index);
            }
        }
        return null;
    }
public function getRandom()
    {
        $this->internalDataListUpdate();
        $count = sizeof($this->internalDataListData);
        if ($count > 0) {
            $index = rand(0, $count - 1);
            if (isset($this->internalDataListData[$index])) {
                return $this->internalDataListUpdateValueIfNeeded($this->internalDataListData, $index);
            }
        }
        return null;
    }
public function getRandom ( ) { $ this -> internalDataListUpdate ( ) ; $ count = sizeof ( $ this -> internalDataListData ) ; if ( $ count > 0 ) { $ index = rand ( 0 , $ count - 1 ) ; if ( isset ( $ this -> internalDataListData [ $ index ] ) ) { return $ this -> internalDataListUpdateValueIfNeeded ( $ this -> internalDataListData , $ index ) ; } } return null ; }
Returns a random object from the list or null if the list is empty.

@return object|null A random object from the list or null if the list is empty.
@throws \InvalidArgumentException
Returns a random object from the list or null if the list is empty .