From 599d735665c9a95134e01f1f415c881d1a3b5304 Mon Sep 17 00:00:00 2001 From: thislight Date: Sat, 28 Sep 2024 22:27:26 +0800 Subject: [PATCH] TootComposer: fix random stmt may be empty --- package.json | 2 +- src/timelines/TootComposer.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 700f2f4..4c0af67 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package", "name": "tutu", - "version": "1.0.6", + "version": "1.0.7", "description": "", "private": true, "type": "module", diff --git a/src/timelines/TootComposer.tsx b/src/timelines/TootComposer.tsx index 0440253..8e4ed25 100644 --- a/src/timelines/TootComposer.tsx +++ b/src/timelines/TootComposer.tsx @@ -183,7 +183,7 @@ function randomChoose( rn: number, K: T, ): T extends Array ? E : never { - const idx = Math.round(rn * K.length); + const idx = Math.round(rn * K.length) - 1; return K[idx]; }