From a487d30001d3ffbba0c026598d8f650cad1acff8 Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Sun, 9 Oct 2022 20:12:55 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=AF=86=E7=A0=81=E9=A6=96=E4=BD=8D?= =?UTF-8?q?=E4=B8=8D=E5=8C=85=E5=90=AB=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/utils/random.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/common/utils/random.py b/apps/common/utils/random.py index db3b39c05..fae1d80bd 100644 --- a/apps/common/utils/random.py +++ b/apps/common/utils/random.py @@ -35,7 +35,7 @@ def random_string(length, lower=True, upper=True, digit=True, special_char=False if special_char: spc = random.choice(string_punctuation) - i = random.choice(range(len(password))) + i = random.choice(range(1, len(password))) password[i] = spc password = ''.join(password)