js生成随机数的方法
var now=new Date();var number = now.getSeconds(); //这将产生一个基于目前时间的0到59的整数。var now=new Date();var number = now.getSeconds()%43; //这将产生一个基于目前时间的0到42的整数。
?
参考资料:?? js如何生成随机数?? http://www.studyofnet.com/news/181.html
发布时间: 2013-11-02 19:41:10 作者: rapoo
js生成随机数的方法
var now=new Date();var number = now.getSeconds(); //这将产生一个基于目前时间的0到59的整数。var now=new Date();var number = now.getSeconds()%43; //这将产生一个基于目前时间的0到42的整数。
?
参考资料:?? js如何生成随机数?? http://www.studyofnet.com/news/181.html