src/Redis/Cluster/Native.php
protected function getRandomConnection(): ?Client
    {
        if ($this->pool) {
            return $this->pool[\array_rand($this->pool)];
        }

        if ($this->hosts) {
            $key = \array_rand($this->hosts);
            $connectionID = $this->hosts[$key];
            unset($key);

            return $this->createConnection($connectionID);
        }

        return null;
    }
protected function getRandomConnection(): ?Client
    {
        if ($this->pool) {
            return $this->pool[\array_rand($this->pool)];
        }

        if ($this->hosts) {
            $key = \array_rand($this->hosts);
            $connectionID = $this->hosts[$key];
            unset($key);

            return $this->createConnection($connectionID);
        }

        return null;
    }
protected function getRandomConnection ( ) : ? Client { if ( $ this -> pool ) { return $ this -> pool [ \ array_rand ( $ this -> pool ) ] ; } if ( $ this -> hosts ) { $ key = \ array_rand ( $ this -> hosts ) ; $ connectionID = $ this -> hosts [ $ key ] ; unset ( $ key ) ; return $ this -> createConnection ( $ connectionID ) ; } return null ; }
Returns a random connection from the pool.

@return Client|null
Returns a random connection from the pool .