code: func (m *Memberlist) resetNodes() {
  	m.nodeLock.Lock()
  	defer m.nodeLock.Unlock()
  
  	// Move dead nodes, but respect gossip to the dead interval
  	deadIdx := moveDeadNodes(m.nodes, m.config.GossipToTheDeadTime)
  
  	// Deregister the dead nodes
  	for i := deadIdx; i < len(m.nodes); i++ {
  		delete(m.nodeMap, m.nodes[i].Name)
  		m.nodes[i] = nil
  	}
  
  	// Trim the nodes to exclude the dead nodes
  	m.nodes = m.nodes[0:deadIdx]
  
  	// Update numNodes after we've trimmed the dead nodes
  	atomic.StoreUint32(&m.numNodes, uint32(deadIdx))
  
  	// Shuffle live nodes
  	shuffleNodes(m.nodes)
  }
docs: // resetNodes is used when the tick wraps around. It will reap the
  // dead nodes and shuffle the node list.