public function random($num = 1)
    {
        $count = \count($this->items);
        if ($num > $count) {
            $num = $count;
        }

        $this->items = array_intersect_key($this->items, array_flip((array)array_rand($this->items, $num)));

        return $this;
    }
public function random($num = 1)
    {
        $count = \count($this->items);
        if ($num > $count) {
            $num = $count;
        }

        $this->items = array_intersect_key($this->items, array_flip((array)array_rand($this->items, $num)));

        return $this;
    }
public function random ( $ num = 1 ) { $ count = \ count ( $ this -> items ) ; if ( $ num > $ count ) { $ num = $ count ; } $ this -> items = array_intersect_key ( $ this -> items , array_flip ( ( array ) array_rand ( $ this -> items , $ num ) ) ) ; return $ this ; }
Pick one or more random entries.

@param int $num Specifies how many entries should be picked.

@return $this
Pick one or more random entries .