code: func (tab *Table) chooseBucketRefreshTarget() common.Hash {
  	entries := 0
  	if printTable {
  		fmt.Println()
  	}
  	for i, b := range &tab.buckets {
  		entries += len(b.entries)
  		if printTable {
  			for _, e := range b.entries {
  				fmt.Println(i, e.state, e.addr().String(), e.ID.String(), e.sha.Hex())
  			}
  		}
  	}
  
  	prefix := binary.BigEndian.Uint64(tab.self.sha[0:8])
  	dist := ^uint64(0)
  	entry := int(randUint(uint32(entries + 1)))
  	for _, b := range &tab.buckets {
  		if entry < len(b.entries) {
  			n := b.entries[entry]
  			dist = binary.BigEndian.Uint64(n.sha[0:8]) ^ prefix
  			break
  		}
  		entry -= len(b.entries)
  	}
  
  	ddist := ^uint64(0)
  	if dist+dist > dist {
  		ddist = dist
  	}
  	targetPrefix := prefix ^ randUint64n(ddist)
  
  	var target common.Hash
  	binary.BigEndian.PutUint64(target[0:8], targetPrefix)
  	rand.Read(target[8:])
  	return target
  }
docs: // chooseBucketRefreshTarget selects random refresh targets to keep all Kademlia
  // buckets filled with live connections and keep the network topology healthy.
  // This requires selecting addresses closer to our own with a higher probability
  // in order to refresh closer buckets too.
  //
  // This algorithm approximates the distance distribution of existing nodes in the
  // table by selecting a random node from the table and selecting a target address
  // with a distance less than twice of that of the selected node.
  // This algorithm will be improved later to specifically target the least recently
  // used buckets.