From d7031c8aeb728630dd0d6b3a392f8d4bd930dcef Mon Sep 17 00:00:00 2001 From: yuq <724490775@qq.com> Date: Thu, 1 Aug 2024 15:15:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9A=82=E6=97=B6=E5=88=A0=E9=99=A4cryp?= =?UTF-8?q?toRandomInt=E5=AF=BC=E5=87=BA(=E5=90=8E=E7=AB=AF=E4=BC=9A?= =?UTF-8?q?=E5=A5=94=E6=BA=83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/math.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/math.ts b/src/math.ts index a92e759..a99775e 100644 --- a/src/math.ts +++ b/src/math.ts @@ -121,15 +121,15 @@ export const randomInt = (v1: number, v2: number): number => { * @example * */ -export const cryptoRandomInt = (): number => { - if (crypto) { - crypto.getRandomValues(cryptoCache); +// export const cryptoRandomInt = (): number => { +// if (crypto) { +// crypto.getRandomValues(cryptoCache); - return cryptoCache[0]; - } else { - return Math.floor(Math.random() * 0xffffffff); - } -}; +// return cryptoCache[0]; +// } else { +// return Math.floor(Math.random() * 0xffffffff); +// } +// }; /** * @description èŽ·å¾—ä¸€ç»„å®‰å…¨çš„éšæœº32使•´æ•° @@ -322,4 +322,4 @@ export const equal = (num1: number, num2: number) => { const facCache = [0, 1, 2]; // å•ä¸ªå®‰å…¨çš„éšæœº32使•´æ•°çš„计算缓冲 -const cryptoCache = new Uint32Array(1); +// const cryptoCache = new Uint32Array(1); -- GitLab