UNPKG

click-captcha

Version:

Chinese Character Sequence Click Verification System

38 lines (37 loc) 883 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Random = void 0; /* * @Author: Qing * @Description: * @Date: 2025-02-05 13:28:41 * @LastEditTime: 2025-07-23 14:24:53 */ class Random { /** * 生成指定范围内的随机整数 */ static int(min, max) { return Math.floor(min + Math.random() * (max - min)); } /** * 生成随机颜色 */ static color() { return `rgb(${this.int(0, 255)},${this.int(0, 255)},${this.int(0, 255)})`; } /** * 生成随机灰度颜色 */ static greyColor(min, max) { const grey = this.int(min, max); return `rgb(${grey},${grey},${grey})`; } /** * 生成指定范围内的随机浮点数 */ static float(min, max) { return min + Math.random() * (max - min); } } exports.Random = Random;