classes/collection/ElementCollection.php
public function random($iCount = 1)
    {
        if ($this->isEmpty()) {
            return [];
        }

        $iCount = (int) trim($iCount);
        if ($iCount < 1) {
            $iCount = 1;
        }

        if (count($this->arElementIDList) < $iCount) {
            $iCount = count($this->arElementIDList);
        }

        $obThis = $this->copy();
        shuffle($obThis->arElementIDList);

        return $obThis->take($iCount);
    }
public function random($iCount = 1)
    {
        if ($this->isEmpty()) {
            return [];
        }

        $iCount = (int) trim($iCount);
        if ($iCount < 1) {
            $iCount = 1;
        }

        if (count($this->arElementIDList) < $iCount) {
            $iCount = count($this->arElementIDList);
        }

        $obThis = $this->copy();
        shuffle($obThis->arElementIDList);

        return $obThis->take($iCount);
    }
public function random ( $ iCount = 1 ) { if ( $ this -> isEmpty ( ) ) { return [ ] ; } $ iCount = ( int ) trim ( $ iCount ) ; if ( $ iCount < 1 ) { $ iCount = 1 ; } if ( count ( $ this -> arElementIDList ) < $ iCount ) { $ iCount = count ( $ this -> arElementIDList ) ; } $ obThis = $ this -> copy ( ) ; shuffle ( $ obThis -> arElementIDList ) ; return $ obThis -> take ( $ iCount ) ; }
Take array with random element items
@link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#randomicount
@param int $iCount
@return array|\Lovata\Toolbox\Classes\Item\ElementItem[]
Take array with random element items