欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js中Math之random,round,ceil,floor的用法總結(jié)

 更新時(shí)間:2013年12月26日 09:47:02   投稿:jingxian  
本篇文章是對(duì)js中Math之random,round,ceil,floor的用法進(jìn)行了總結(jié)介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助

<SPAN style="FONT-SIZE: 18px">1.Math.random(); 結(jié)果為0-1間的一個(gè)隨機(jī)數(shù)(包括0,不包括1) </SPAN> 
Math.random(); 結(jié)果為0-1間的一個(gè)隨機(jī)數(shù)(包括0,不包括1) [html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px"> 
 
2.Math.floor(num); 參數(shù)num為一個(gè)數(shù)值,函數(shù)結(jié)果為num的整數(shù)部分(返回小于等于n的最大整數(shù))。</SPAN> 


Math.floor(num); 參數(shù)num為一個(gè)數(shù)值,函數(shù)結(jié)果為num的整數(shù)部分(返回小于等于n的最大整數(shù))。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px"> 
  
3.Math.round(num); 參數(shù)num為一個(gè)數(shù)值,函數(shù)結(jié)果為num四舍五入后的整數(shù)。</SPAN> 


Math.round(num); 參數(shù)num為一個(gè)數(shù)值,函數(shù)結(jié)果為num四舍五入后的整數(shù)。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px"> 
 
4.Math.ceil(n); 返回大于等于n的最小整數(shù)。</SPAN> 


Math.ceil(n); 返回大于等于n的最小整數(shù)。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px"> 
 
5.Math.ceil(Math.random()*10);時(shí),主要獲取1到10的隨機(jī)整數(shù),取0的幾率極小。</SPAN> 


Math.ceil(Math.random()*10);時(shí),主要獲取1到10的隨機(jī)整數(shù),取0的幾率極小。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px"> 
 
6.Math.round(Math.random());可均衡獲取0到1的隨機(jī)整數(shù)。</SPAN> 


Math.round(Math.random());可均衡獲取0到1的隨機(jī)整數(shù)。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px"> 
 
7.Math.round(Math.random()*10);時(shí),可基本均衡獲取0到10的隨機(jī)整數(shù),其中獲取最小值0和最大值10的幾率少一半。</SPAN> 


Math.round(Math.random()*10);時(shí),可基本均衡獲取0到10的隨機(jī)整數(shù),其中獲取最小值0和最大值10的幾率少一半。[html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px"> 
 
8.Math.floor(Math.random()*10);時(shí),可均衡獲取0到9的隨機(jī)整數(shù)。</SPAN> 

相關(guān)文章

最新評(píng)論