实现调用方法fnRandom(10,30,false)生成10到30之间的随机数(有小数) 第三个参数为true的话,返回整形(没有小数)

<script type="text/javascript">
alert( fnRandom( 10 , 30 , false ) );
function fnRandom( start , end , bInt ){
var m = end - start; //要乘的范围大小
var result = Math.random()*m+start;
if(bInt){
result = parseInt( result );
}
return result;
}
</script>

原文地址:https://www.cnblogs.com/lijiahui199494/p/5825029.html