javascript Math.random函數參數

random函數參數

無參數dom

random函數返回值

返回0和1之間的僞隨機數,可能爲0,但老是小於1,[0,1)函數

random函數示例

document.write(Math.random());

返回隨機數spa

document.write(Math.random()*(20-10)+10);

返回10-20的隨機數code

document.write(Math.random()*(n-m)+m);

返回指定範圍的隨機數(m-n之間)的公式it

相關文章
相關標籤/搜索