最赞回答 / 木子舟义
function g(selector){ return selector.substring(0, 1) == '.' ? document.getElementsByClassName(selector.substring(1)) : document.getElementById(selector.substring(1)); }
2015-12-04
function random (range) {
var max = Math.max( range[0], range[1] );
var min = Math.min( range[0], range[1] );
var diff = max-min+1;
var number = Math.floor( (Math.random() * diff +min) );
return number;
}
酱才可以取到[min, max]的闭区间值~
var max = Math.max( range[0], range[1] );
var min = Math.min( range[0], range[1] );
var diff = max-min+1;
var number = Math.floor( (Math.random() * diff +min) );
return number;
}
酱才可以取到[min, max]的闭区间值~
2015-11-30