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

相关文章
相关标签/搜索