mirror of
https://github.com/vastxie/99AI.git
synced 2025-11-12 19:53:42 +08:00
NineAI 2.4.2
This commit is contained in:
11
dist/common/utils/getRandomItemFromArray.js
vendored
Normal file
11
dist/common/utils/getRandomItemFromArray.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getRandomItemFromArray = void 0;
|
||||
function getRandomItemFromArray(array) {
|
||||
if (array.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const randomIndex = Math.floor(Math.random() * array.length);
|
||||
return array[randomIndex];
|
||||
}
|
||||
exports.getRandomItemFromArray = getRandomItemFromArray;
|
||||
Reference in New Issue
Block a user