function random(int $num = 1) {
        $rand = \array_rand($this->data, $num);
        if(!\is_array($rand)) {
            $rand = array($rand);
        }
        
        $col = new self();
        foreach($rand as $key) {
            $col->set($key, $this->data[$key]);
        }
        
        return $col;
    }
function random(int $num = 1) {
        $rand = \array_rand($this->data, $num);
        if(!\is_array($rand)) {
            $rand = array($rand);
        }
        
        $col = new self();
        foreach($rand as $key) {
            $col->set($key, $this->data[$key]);
        }
        
        return $col;
    }
function random ( int $ num = 1 ) { $ rand = \ array_rand ( $ this -> data , $ num ) ; if ( ! \ is_array ( $ rand ) ) { $ rand = array ( $ rand ) ; } $ col = new self ( ) ; foreach ( $ rand as $ key ) { $ col -> set ( $ key , $ this -> data [ $ key ] ) ; } return $ col ; }
Returns one random item, or multiple random items inside a Collection, from the Collection. Returns a new Collection.
@param int  $num
@return \CharlotteDunois\Collect\Collection
Returns one random item or multiple random items inside a Collection from the Collection . Returns a new Collection .