def get_network(self, network: Network, disconnect_probability: float) -> Network: return network.map_nodes( lambda n: n.replace(disconnect_before_tests=random.random() < disconnect_probability) )
def get_network(self, network: Network, malicious_probability: float) -> Network: return network.map_nodes(lambda n: _to_malicious_node(n) if random. random() < malicious_probability else n)