1.Math.random(); 結果爲0-1間的一個隨機數(包括0,不包括1) </SPAN>
Math.random(); 結果爲0-1間的一個隨機數(包括0,不包括1) [html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
2.Math.floor(num); 參數num爲一個數值,函數結果爲num的整數部分(返回小於等於n的最大整數)。</SPAN>
Math.floor(num); 參數num爲一個數值,函數結果爲num的整數部分(返回小於等於n的最大整數)。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
3.Math.round(num); 參數num爲一個數值,函數結果爲num四捨五入後的整數。</SPAN>
Math.round(num); 參數num爲一個數值,函數結果爲num四捨五入後的整數。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
4.Math.ceil(n); 返回大於等於n的最小整數。</SPAN>
Math.ceil(n); 返回大於等於n的最小整數。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
5.Math.ceil(Math.random()*10);時,主要獲取1到10的隨機整數,取0的機率極小。</SPAN>
Math.ceil(Math.random()*10);時,主要獲取1到10的隨機整數,取0的機率極小。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
6.Math.round(Math.random());可均衡獲取0到1的隨機整數。</SPAN>
Math.round(Math.random());可均衡獲取0到1的隨機整數。