js 返回两数(包含这两数)之间的随机数函数
时间:2014-01-21 16:31:40
收藏:0
阅读:419
function selectFrom( lowerValue, upperValue ){ var choices = upperValue - lowerValue + 1; return Math.floor( Math.random() * choices + lowerValue ); } var num = selectFrom( 2,10 ); alert( num );
原文:http://www.cnblogs.com/sunsweet/p/3527214.html
评论(0)
