diff --git a/json2xml/dicttoxml.py b/json2xml/dicttoxml.py index 3229a1c9..5a950753 100755 --- a/json2xml/dicttoxml.py +++ b/json2xml/dicttoxml.py @@ -16,18 +16,19 @@ import numbers import os from collections.abc import Callable, Sequence -from random import randint +from random import SystemRandom from typing import Any, Dict, Union from defusedxml.minidom import parseString +safe_random = SystemRandom() DEBUGMODE = os.getenv("DEBUGMODE", False) # pragma: no cover LOG = logging.getLogger("dicttoxml") # pragma: no cover def make_id(element: str, start: int = 100000, end: int = 999999) -> str: """Returns a random integer""" - return f"{element}_{randint(start, end)}" + return f"{element}_{safe_random.randint(start, end)}" def get_unique_id(element: str) -> str: