From b211148c0a8fed359c6ce11338e0306e4b191c10 Mon Sep 17 00:00:00 2001 From: ge Date: Tue, 16 Jan 2024 22:24:42 +0300 Subject: [PATCH] upd rendom_mac() --- compute/utils/ids.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/compute/utils/ids.py b/compute/utils/ids.py index 5cd9559..8886764 100644 --- a/compute/utils/ids.py +++ b/compute/utils/ids.py @@ -15,19 +15,19 @@ """Random identificators.""" -# ruff: noqa: S311, C417 +# ruff: noqa: S311 import random def random_mac() -> str: """Retrun random MAC address.""" - mac = [ - 0x00, - 0x16, - 0x3E, - random.randint(0x00, 0x7F), + bits = [ + 0x0A, + random.randint(0x00, 0xFF), + random.randint(0x00, 0xFF), + random.randint(0x00, 0xFF), random.randint(0x00, 0xFF), random.randint(0x00, 0xFF), ] - return ':'.join(map(lambda x: '%02x' % x, mac)) + return ':'.join([f'{b:02x}' for b in bits])