code: private String chooseHost(String[] dbHosts) {
          String host = null;
          synchronized (m_lastHostLock) {
              if (dbHosts.length == 1) {
                  host = dbHosts[0];
              } else if (!Utils.isEmpty(m_lastHost)) {
                  for (int index = 0; host == null && index < dbHosts.length; index++) {
                      if (dbHosts[index].equals(m_lastHost)) {
                          host = dbHosts[(++index) % dbHosts.length];
                      }
                  }
              }
              if (host == null) {
                  host = dbHosts[new Random().nextInt(dbHosts.length)];
              }
              m_lastHost = host;
          }
          return host;
      }
docs: Choose the next Cassandra host name in the list or a random one.