Example #1
0
 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)
     )
Example #2
0
 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)