js里任意两个数之间的随机数函数

来源:互联网 发布:网络爬虫实战 编辑:程序博客网 时间:2024/05/18 00:06
/** * JS获取n至m随机整数 * 琼台博客 */function rd(n,m){    var c = m-n+1;      return Math.floor(Math.random() * c + n);}function selectfrom (lowValue,highValue){var choice=highValue-lowValue+1;return Math.floor(Math.random()*choice+lowValue);}

0 0
原创粉丝点击