From 89af066d12d7ea0649544159f550f8191d960d50 Mon Sep 17 00:00:00 2001 From: dy Date: Fri, 29 Dec 2023 01:07:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E6=BB=9A=E5=85=AC=E7=94=A8=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/global.ts | 2 +- src/shared/public/public.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/global.ts b/src/global.ts index 20bc6b0..26105d1 100644 --- a/src/global.ts +++ b/src/global.ts @@ -233,7 +233,7 @@ export function ctor() { } Array.prototype.random = function (this: Array) { - return this[PublicShared.randomNum(0, this.length - 1)]; + return this[PublicShared.randomNum(0, this.length)]; }; Array.prototype.intersection = function (this: Array, other: Array) { diff --git a/src/shared/public/public.ts b/src/shared/public/public.ts index 5c8d5b6..02c3aa2 100644 --- a/src/shared/public/public.ts +++ b/src/shared/public/public.ts @@ -115,7 +115,7 @@ export class PublicShared { * 随机生成区间范围整数 */ static randomNum(min: number, max: number) { - return Math.floor(Math.random() * (max - min + 1) + min); + return Math.floor(Math.random() * (max - min) + min); } /**获取道具配置 */ static getAtnConf(atn: prizeType) {