mirror of
https://github.com/logos-co/nomos-specs.git
synced 2025-02-01 10:06:10 +00:00
use choices
This commit is contained in:
parent
e1abc44592
commit
e558ba4e6d
@ -51,9 +51,9 @@ class MixMembership:
|
||||
|
||||
def generate_route(self, length: int) -> list[NodeInfo]:
|
||||
"""
|
||||
Generate a mix route for a Sphinx packet.
|
||||
Choose `length` nodes with replacement as a mix route.
|
||||
"""
|
||||
return [random.choice(self.nodes) for _ in range(length)]
|
||||
return random.choices(self.nodes, k=length)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
Loading…
x
Reference in New Issue
Block a user