JS代码如下:
/**
*
* @param
* @arrange (512.笔记) jb51.cc
**/
//生成从minNum到maxNum的随机数
function randomNum(minNum,maxNum){
switch(arguments.length){
case 1:
return parseInt(Math.random()*minNum+1,10);
break;
case 2:
return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10);
break;
default:
return 0;
break;
}
}
// 来自:编程之家 jb51.cc(jb51.cc)
原文链接:https://www.f2er.com/js/527597.html