From c518bf5a86816f691bbf5e66de44cd851f4b9919 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Tue, 23 Jul 2024 17:26:50 +0200 Subject: [PATCH] fix random ShortId --- frontend/src/plugins/randomUtil.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/plugins/randomUtil.ts b/frontend/src/plugins/randomUtil.ts index 3143915..f9da01f 100644 --- a/frontend/src/plugins/randomUtil.ts +++ b/frontend/src/plugins/randomUtil.ts @@ -36,13 +36,13 @@ const RandomUtil = { }, randomShortId(): string[] { let shortIds = new Array(24).fill('') - for (var ii = 0; ii < 24; ii++) { - for (var jj = 0; jj < this.randomInt(8); jj++){ - let randomNum = this.randomInt(256) - shortIds[ii] += ('0' + randomNum.toString(16)).slice(-2) - } - } - return shortIds + for (var ii = 1; ii < 24; ii++) { + for (var jj = 0; jj <= this.randomInt(7); jj++){ + let randomNum = this.randomInt(256) + shortIds[ii] += ('0' + randomNum.toString(16)).slice(-2) + } + } + return shortIds } }