From e558ba4e6d735a5c388f0ad8f3b37bbd0473f8ac Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Thu, 11 Jul 2024 17:00:11 +0900 Subject: [PATCH] use choices --- mixnet/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mixnet/config.py b/mixnet/config.py index 18a0504..f4127e3 100644 --- a/mixnet/config.py +++ b/mixnet/config.py @@ -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