Distributed task assignment based on gossip with guaranteed performance on heterogeneous networks