lib/aerospike/cluster.rb
def random_node
      # Must copy array reference for copy on write semantics to work.
      node_array = nodes
      length = node_array.length
      i = 0
      while i < length
        # Must handle concurrency with other non-tending threads, so node_index is consistent.
        index = (@node_index.update{ |v| v+1 } % node_array.length).abs
        node = node_array[index]

        return node if node.active?

        i = i.succ
      end
      raise Aerospike::Exceptions::InvalidNode
    end
def random_node
      # Must copy array reference for copy on write semantics to work.
      node_array = nodes
      length = node_array.length
      i = 0
      while i < length
        # Must handle concurrency with other non-tending threads, so node_index is consistent.
        index = (@node_index.update{ |v| v+1 } % node_array.length).abs
        node = node_array[index]

        return node if node.active?

        i = i.succ
      end
      raise Aerospike::Exceptions::InvalidNode
    end
Returns a random node on the cluster