返回介于0(包含)~1(包含)之間的一個隨機(jī)數(shù)
Math.random()
返回介于1(包含)~10(包含)之間的一個隨機(jī)數(shù)
Math.floor((Math.random()*10)+1);
返回介于min(包含)~max(包含)之間的一個隨機(jī)數(shù)
function getRndInteger(min, max) {
return Math.floor(Math.random() * (max - min) ) + min;}
Math.random()
Math.floor((Math.random()*10)+1);
function getRndInteger(min, max) {
return Math.floor(Math.random() * (max - min) ) + min;}

非特殊說明,本博所有文章均為博主原創(chuàng)。
如若轉(zhuǎn)載,請注明出處:http://www.add-long.com/view/47.html