CNCEC_APP/uni_modules/uview-pro/libs/function/random.ts

17 lines
391 B
TypeScript
Raw Normal View History

2026-03-25 14:54:15 +08:00
/**
*
* @param min
* @param max
* @returns
*/
function random(min: number, max: number): number {
if (min >= 0 && max > 0 && max >= min) {
const gab = max - min + 1;
return Math.floor(Math.random() * gab + min);
} else {
return 0;
}
}
export default random;