TootComposer: fix random stmt may be empty

This commit is contained in:
thislight 2024-09-28 22:27:26 +08:00
parent 591a930bb6
commit a6b791ab5a
No known key found for this signature in database
GPG key ID: A50F9451AC56A63E
2 changed files with 2 additions and 2 deletions

View file

@ -183,7 +183,7 @@ function randomChoose<T extends any[]>(
rn: number,
K: T,
): T extends Array<infer E> ? E : never {
const idx = Math.round(rn * K.length);
const idx = Math.round(rn * K.length) - 1;
return K[idx];
}