wszhyWx/node_modules/uview-ui/libs/function/random.js

11 lines
196 B
JavaScript
Raw Normal View History

2023-09-28 10:07:02 +00:00
function random(min, max) {
if (min >= 0 && max > 0 && max >= min) {
let gab = max - min + 1;
return Math.floor(Math.random() * gab + min);
} else {
return 0;
}
}
export default random;